feat : 新增seg anything 接口 ,接口文档补充
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user