design brand dna 部署
This commit is contained in:
34
app/api/api_brand_dna.py
Normal file
34
app/api/api_brand_dna.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from app.schemas.brand_dna import BrandDnaModel
|
||||
from app.schemas.response_template import ResponseModel
|
||||
from app.service.brand_dna.service import BrandDna
|
||||
|
||||
router = APIRouter()
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
@router.post("/seg_product")
|
||||
def image2sketch(request_item: BrandDnaModel):
|
||||
"""
|
||||
创建一个具有以下参数的请求体:
|
||||
- **image_url**: 提取图片url
|
||||
- **is_brand_dna**: 是否提取属性
|
||||
|
||||
示例参数:
|
||||
{
|
||||
"image_url": "test/image2sketch/real_Dress_3200fecdc83d0c556c2bd96aedbd7fbf.jpg_Img.jpg",
|
||||
"is_brand_dna": False
|
||||
}
|
||||
"""
|
||||
try:
|
||||
logger.info(f"brand dna request item is : @@@@@@:{json.dumps(request_item.dict())}")
|
||||
service = BrandDna(request_item)
|
||||
result_url = service.get_result()
|
||||
except Exception as e:
|
||||
logger.warning(f"brand dna Run Exception @@@@@@:{e}")
|
||||
raise HTTPException(status_code=404, detail=str(e))
|
||||
return ResponseModel(data=result_url)
|
||||
Reference in New Issue
Block a user