feat: 停用flux2 img2product 复用sdxl img2product
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
fix:
This commit is contained in:
@@ -184,77 +184,78 @@ async def generate_slogan(request_data: GenerateSloganImageModel):
|
|||||||
"""product image flux2.0"""
|
"""product image flux2.0"""
|
||||||
|
|
||||||
|
|
||||||
@router.post("/img_to_product")
|
# @router.post("/img_to_product")
|
||||||
async def img_to_product(request_data: Flux2ToProductImgModel):
|
# async def img_to_product(request_data: Flux2ToProductImgModel):
|
||||||
"""
|
|
||||||
创建一个具有以下参数的请求体:
|
|
||||||
- **tasks_id**: 任务id 用于取消生成任务和获取生成结果
|
|
||||||
- **prompt**: 想要生成图片的描述词
|
|
||||||
- **image_path**: 被生成图片的S3或minio url地址
|
|
||||||
- **infer_step**: 推理步数
|
|
||||||
|
|
||||||
### 请求体示例:
|
|
||||||
```json
|
|
||||||
point
|
|
||||||
{
|
|
||||||
"prompt": "Create realistic studio photo with real people model standing and wearing this garment, in white studio, Keep original model if present, or generate appropriate model, Standing pose, facing camera.",
|
|
||||||
"image_path":"aida-results/result_38151e0a-f83b-11f0-89f6-0242ac130002.png",
|
|
||||||
"infer_step":4,
|
|
||||||
"tasks_id":"123456-123"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info(f"img_to_product request item is : @@@@@@:{json.dumps(request_data.dict(), indent=4)}")
|
|
||||||
data = requests.post(f"http://{settings.A6000_SERVICE_HOST}:10090/api/v1/to_product", json=request_data.dict())
|
|
||||||
logger.info(f"img_to_product response @@@@@@:{json.dumps(json.loads(data.content), indent=4)}")
|
|
||||||
return ResponseModel(data=json.loads(data.content))
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"img_to_product Run Exception @@@@@@:{e}")
|
|
||||||
|
|
||||||
|
|
||||||
'''product image 停用'''
|
|
||||||
|
|
||||||
# @router.post("/generate_product_image")
|
|
||||||
# def generate_product_image(request_item: GenerateProductImageModel, background_tasks: BackgroundTasks):
|
|
||||||
# """
|
# """
|
||||||
# 创建一个具有以下参数的请求体:
|
# 创建一个具有以下参数的请求体:
|
||||||
# - **tasks_id**: 任务id 用于取消生成任务和获取生成结果
|
# - **tasks_id**: 任务id 用于取消生成任务和获取生成结果
|
||||||
# - **prompt**: 想要生成图片的描述词
|
# - **prompt**: 想要生成图片的描述词
|
||||||
# - **image_url**: 被生成图片的S3或minio url地址
|
# - **image_path**: 被生成图片的S3或minio url地址
|
||||||
# - **image_strength**: 生成强度,越低越接近原图
|
# - **infer_step**: 推理步数
|
||||||
# - **product_type**: 输入single item 还是 overall item
|
|
||||||
#
|
#
|
||||||
#
|
# ### 请求体示例:
|
||||||
# 示例参数:
|
# ```json
|
||||||
|
# point
|
||||||
# {
|
# {
|
||||||
# "tasks_id": "123-89",
|
# "prompt": "Create realistic studio photo with real people model standing and wearing this garment, in white studio, Keep original model if present, or generate appropriate model, Standing pose, facing camera.",
|
||||||
# "prompt": "the best quality, masterpiece. detailed, high-res, simple background, studio photography, extremely detailed, updo, detailed face, face, close-up, HDR, UHD, 8K realistic, Highly detailed, simple background, Studio lighting",
|
# "image_path":"aida-results/result_38151e0a-f83b-11f0-89f6-0242ac130002.png",
|
||||||
# "image_url": "aida-results/result_00097282-ebb2-11ee-a822-b48351119060.png",
|
# "infer_step":4,
|
||||||
# "image_strength": 0.8,
|
# "tasks_id":"123456-123"
|
||||||
# "product_type": "overall"
|
|
||||||
# }
|
# }
|
||||||
|
# ```
|
||||||
# """
|
# """
|
||||||
# try:
|
# try:
|
||||||
# logger.info(f"generate_product_image request item is : @@@@@@:{json.dumps(request_item.dict(), indent=4)}")
|
# logger.info(f"img_to_product request item is : @@@@@@:{json.dumps(request_data.dict(), indent=4)}")
|
||||||
# service = GenerateProductImage(request_item)
|
# data = requests.post(f"http://{settings.A6000_SERVICE_HOST}:10090/api/v1/to_product", json=request_data.dict())
|
||||||
# background_tasks.add_task(service.get_result)
|
# logger.info(f"img_to_product response @@@@@@:{json.dumps(json.loads(data.content), indent=4)}")
|
||||||
|
# return ResponseModel(data=json.loads(data.content))
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.warning(f"generate_product_image Run Exception @@@@@@:{e}")
|
# logger.warning(f"img_to_product Run Exception @@@@@@:{e}")
|
||||||
# raise HTTPException(status_code=404, detail=str(e))
|
|
||||||
# return ResponseModel()
|
|
||||||
#
|
'''product image'''
|
||||||
#
|
|
||||||
# @router.get("/generate_product_image_cancel_cancel/{tasks_id}")
|
|
||||||
# def generate_product_image(tasks_id: str):
|
@router.post("/generate_product_image")
|
||||||
# try:
|
def generate_product_image(request_item: GenerateProductImageModel, background_tasks: BackgroundTasks):
|
||||||
# logger.info(f"generate_product_image_cancel_cancel request item is : @@@@@@:{tasks_id}")
|
"""
|
||||||
# data = generate_product_image_cancel(tasks_id)
|
创建一个具有以下参数的请求体:
|
||||||
# logger.info(f"generate_product_image_cancel_cancel response @@@@@@:{data}")
|
- **tasks_id**: 任务id 用于取消生成任务和获取生成结果
|
||||||
# except Exception as e:
|
- **prompt**: 想要生成图片的描述词
|
||||||
# logger.warning(f"generate_product_image_cancel_cancel Run Exception @@@@@@:{e}")
|
- **image_url**: 被生成图片的S3或minio url地址
|
||||||
# raise HTTPException(status_code=404, detail=str(e))
|
- **image_strength**: 生成强度,越低越接近原图
|
||||||
# return ResponseModel(data=data['data'])
|
- **product_type**: 输入single item 还是 overall item
|
||||||
|
|
||||||
|
|
||||||
|
示例参数:
|
||||||
|
{
|
||||||
|
"tasks_id": "123-89",
|
||||||
|
"prompt": "the best quality, masterpiece. detailed, high-res, simple background, studio photography, extremely detailed, updo, detailed face, face, close-up, HDR, UHD, 8K realistic, Highly detailed, simple background, Studio lighting",
|
||||||
|
"image_url": "aida-results/result_00097282-ebb2-11ee-a822-b48351119060.png",
|
||||||
|
"image_strength": 0.8,
|
||||||
|
"product_type": "overall"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
logger.info(f"generate_product_image request item is : @@@@@@:{json.dumps(request_item.dict(), indent=4)}")
|
||||||
|
service = GenerateProductImage(request_item)
|
||||||
|
background_tasks.add_task(service.get_result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"generate_product_image Run Exception @@@@@@:{e}")
|
||||||
|
raise HTTPException(status_code=404, detail=str(e))
|
||||||
|
return ResponseModel()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/generate_product_image_cancel_cancel/{tasks_id}")
|
||||||
|
def generate_product_image(tasks_id: str):
|
||||||
|
try:
|
||||||
|
logger.info(f"generate_product_image_cancel_cancel request item is : @@@@@@:{tasks_id}")
|
||||||
|
data = generate_product_image_cancel(tasks_id)
|
||||||
|
logger.info(f"generate_product_image_cancel_cancel response @@@@@@:{data}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"generate_product_image_cancel_cancel Run Exception @@@@@@:{e}")
|
||||||
|
raise HTTPException(status_code=404, detail=str(e))
|
||||||
|
return ResponseModel(data=data['data'])
|
||||||
|
|
||||||
|
|
||||||
'''relight image 停用'''
|
'''relight image 停用'''
|
||||||
|
|||||||
Reference in New Issue
Block a user