feat(新功能): brand name slogan logo 生成服务
fix(修复bug): docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -3,16 +3,17 @@ import logging
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from app.schemas.brand_dna import BrandDnaModel
|
||||
from app.schemas.brand_dna import BrandDnaModel, GenerateBrandModel
|
||||
from app.schemas.response_template import ResponseModel
|
||||
from app.service.brand_dna.service import BrandDna
|
||||
from app.service.brand_dna.service_generate_brand_info import GenerateBrandInfo
|
||||
|
||||
router = APIRouter()
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
@router.post("/seg_product")
|
||||
def image2sketch(request_item: BrandDnaModel):
|
||||
def seg_product(request_item: BrandDnaModel):
|
||||
"""
|
||||
创建一个具有以下参数的请求体:
|
||||
- **image_url**: 提取图片url
|
||||
@@ -32,3 +33,27 @@ def image2sketch(request_item: BrandDnaModel):
|
||||
logger.warning(f"brand dna Run Exception @@@@@@:{e}")
|
||||
raise HTTPException(status_code=404, detail=str(e))
|
||||
return ResponseModel(data=result_url)
|
||||
|
||||
|
||||
@router.post("/GenerateBrand")
|
||||
def GenerateBrand(request_data: GenerateBrandModel):
|
||||
"""
|
||||
通过prompt 生成 brand name ,brand slogan , brand logo。
|
||||
创建一个具有以下参数的请求体:
|
||||
- **prompt**:
|
||||
|
||||
示例参数:
|
||||
{
|
||||
"prompt": "xiaomi",
|
||||
"user_id": "89"
|
||||
}
|
||||
"""
|
||||
try:
|
||||
logger.info(f"GenerateBrand request item is : @@@@@@:{request_data}")
|
||||
service = GenerateBrandInfo(request_data)
|
||||
data = service.get_result()
|
||||
logger.info(f"GenerateBrand response @@@@@@:{data}")
|
||||
except Exception as e:
|
||||
logger.warning(f"GenerateBrand Run Exception @@@@@@:{e}")
|
||||
raise HTTPException(status_code=404, detail=str(e))
|
||||
return ResponseModel(data=data)
|
||||
|
||||
Reference in New Issue
Block a user