update
This commit is contained in:
parent
5d805b6fc6
commit
adca35f7bf
@ -14,6 +14,8 @@ from app.schemas.tryon import (
|
||||
)
|
||||
from app.services.dashscope_service import DashScopeService
|
||||
from app.utils.response import APIResponse
|
||||
from app.services.qcloud_service import QCloudCOSService
|
||||
|
||||
# 加载环境变量
|
||||
load_dotenv()
|
||||
|
||||
@ -209,7 +211,20 @@ async def check_tryon_status(
|
||||
|
||||
# 如果任务完成,保存结果URL
|
||||
if db_tryon.task_status == "SUCCEEDED":
|
||||
db_tryon.completion_url = status_response.get("image_url")
|
||||
url = status_response.get("image_url")
|
||||
# 下载图片并上传到自己的腾讯云
|
||||
# 下载图片
|
||||
response = httpx.get(url)
|
||||
image_data = response.content
|
||||
|
||||
# 上传到腾讯云
|
||||
# 获取腾讯云的配置
|
||||
qcloud_service = QCloudCOSService()
|
||||
# 上传图片到腾讯云
|
||||
upload_result = qcloud_service.upload_file(image_data, "tryon_results")
|
||||
|
||||
|
||||
db_tryon.completion_url = upload_result.get("url")
|
||||
|
||||
db.commit()
|
||||
db.refresh(db_tryon)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user