diff --git a/app/routers/tryon_router.py b/app/routers/tryon_router.py index d985d49..561efb7 100644 --- a/app/routers/tryon_router.py +++ b/app/routers/tryon_router.py @@ -214,20 +214,20 @@ async def check_tryon_status( url = status_response.get("image_url") # 下载图片并上传到自己的腾讯云 # 下载图片 - response = httpx.get(url) - image_data = response.content + async with httpx.AsyncClient() as client: + response = await client.get(url) + image_data = response.content - # 上传到腾讯云 - # 获取腾讯云的配置 - qcloud_service = QCloudCOSService() - # 上传图片到腾讯云 - upload_result = qcloud_service.upload_file(image_data, "tryon_results") + # 上传到腾讯云 + # 获取腾讯云的配置 + qcloud_service = QCloudCOSService() + # 上传图片到腾讯云 + 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.refresh(db_tryon) + db.commit() + db.refresh(db_tryon) logger.info(f"试穿任务状态更新: {db_tryon.task_status}") except Exception as e: