This commit is contained in:
aaron 2025-03-25 12:12:05 +08:00
parent adca35f7bf
commit 2fc2650e82

View File

@ -214,20 +214,20 @@ async def check_tryon_status(
url = status_response.get("image_url") url = status_response.get("image_url")
# 下载图片并上传到自己的腾讯云 # 下载图片并上传到自己的腾讯云
# 下载图片 # 下载图片
response = httpx.get(url) async with httpx.AsyncClient() as client:
image_data = response.content response = await client.get(url)
image_data = response.content
# 上传到腾讯云 # 上传到腾讯云
# 获取腾讯云的配置 # 获取腾讯云的配置
qcloud_service = QCloudCOSService() qcloud_service = QCloudCOSService()
# 上传图片到腾讯云 # 上传图片到腾讯云
upload_result = qcloud_service.upload_file(image_data, "tryon_results") upload_result = qcloud_service.upload_file(image_data, "tryon_results")
db_tryon.completion_url = upload_result.get("url")
db_tryon.completion_url = upload_result.get("url")
db.commit() db.commit()
db.refresh(db_tryon) db.refresh(db_tryon)
logger.info(f"试穿任务状态更新: {db_tryon.task_status}") logger.info(f"试穿任务状态更新: {db_tryon.task_status}")
except Exception as e: except Exception as e: