diff --git a/app/api/api_design.py b/app/api/api_design.py index 853b6d8..e7438cc 100644 --- a/app/api/api_design.py +++ b/app/api/api_design.py @@ -376,6 +376,27 @@ async def design_v2(request_data: DesignStreamModel, background_tasks: Backgroun @router.post("/seg_anything") async def seg_anything(request_data: SAMRequestModel): + """ + **Segment Anything 交互式分割接口** + + 通过传入图片路径和点击的点坐标,返回分割后的掩码数据。 + + ### 参数说明: + - **image_path**: 图片在服务器或云端的相对路径。 + - **points**: 交互点的坐标列表。每个点为 [x, y] 像素格式。 + - **labels**: 坐标点的属性标签,必须与 points 长度一致: + - 1: **前景点** (代表想要分割出的区域) + - 0: **背景点** (代表想要排除的区域) + + ### 请求体示例: + ```json + { + "image_path": "aida-users/89/sketch/4e8fe37d-7068-400a-ac94-c01647fa5f6f.png", + "points": [[310, 403], [493, 375], [261, 266], [404, 484]], + "labels": [1, 1, 0, 1] + } + ``` + """ try: logger.info(f"seg_anything request item is : @@@@@@:{json.dumps(request_data.dict(), indent=4)}") data = requests.post("http://10.1.1.240:10075/predict", json=request_data.dict())