From 15682036b31c5462be43048938bc0154d9a628d3 Mon Sep 17 00:00:00 2001 From: zcr Date: Thu, 8 Jan 2026 17:39:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E6=96=B0=E5=A2=9Eseg=20anything=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=20,=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/api_design.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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())