feat sketch 提取接口

fix
This commit is contained in:
zhouchengrong
2024-08-14 16:45:34 +08:00
parent 281f812636
commit d11beb0107
25 changed files with 2681 additions and 8 deletions

View File

@@ -0,0 +1,36 @@
import json
import logging
from fastapi import APIRouter, HTTPException
from app.schemas.image2sketch import Image2SketchModel
from app.schemas.response_template import ResponseModel
from app.service.image2sketch.server import Image2SketchServer
router = APIRouter()
logger = logging.getLogger()
@router.post("/image2sketch")
def image2sketch(request_item: Image2SketchModel):
"""
创建一个具有以下参数的请求体:
- **sr_image_url**: 超分图片的minio或s3 url地址
- **sr_xn**: 超分的倍数只接受2或4
- **sr_tasks_id**: 任务id 用于取消超分任务和获取超分结果
示例参数:
{
"image_url": "test/real_Top_971fe3085a69f31f3e66c225eabb0eea.jpg_Img.jpg",
"sketch_bucket": "test",
"sketch_name": "12341556-89.jpg"
}
"""
# try:
logger.info(f"image2sketch request item is : @@@@@@:{json.dumps(request_item.dict())}")
service = Image2SketchServer(request_item)
sketch_url = service.get_result()
# except Exception as e:
# logger.warning(f"image2sketch Run Exception @@@@@@:{e}")
# raise HTTPException(status_code=404, detail=str(e))
return ResponseModel(data=sketch_url)

View File

@@ -1,14 +1,14 @@
from fastapi import APIRouter
from app.api import api_test
from app.api import api_super_resolution
from app.api import api_generate_image
from app.api import api_attribute_retrieve
from app.api import api_design
from app.api import api_chat_robot
from app.api import api_prompt_generation
from app.api import api_design
from app.api import api_design_pre_processing
from app.api import api_generate_image
from app.api import api_image2sketch
from app.api import api_prompt_generation
from app.api import api_super_resolution
from app.api import api_test
router = APIRouter()
@@ -20,3 +20,4 @@ router.include_router(api_design.router, tags=['design'], prefix="/api")
router.include_router(api_chat_robot.router, tags=['chat_robot'], prefix="/api")
router.include_router(api_prompt_generation.router, tags=['prompt_generation'], prefix="/api")
router.include_router(api_design_pre_processing.router, tags=['design_pre_processing'], prefix="/api")
router.include_router(api_image2sketch.router, tags=['api_image2sketch'], prefix="/api")