Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -380,7 +380,12 @@ def upload_file(file: UploadFile = File(...), file_type: str = Form(...), curren
|
|
| 380 |
os.remove(local_tmp_path)
|
| 381 |
|
| 382 |
# 🚀 核心修复:不再返回暴露隐私且报 401 的 HF 直链,而是返回我们刚写好的 Proxy 代理链接
|
| 383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
return {"status": "success", "url": permanent_url}
|
| 385 |
|
| 386 |
|
|
|
|
| 380 |
os.remove(local_tmp_path)
|
| 381 |
|
| 382 |
# 🚀 核心修复:不再返回暴露隐私且报 401 的 HF 直链,而是返回我们刚写好的 Proxy 代理链接
|
| 383 |
+
if file_type == "post_video":
|
| 384 |
+
# 视频文件返回相对路径,由前端 proxyImages 统一处理
|
| 385 |
+
# 前端会将其转换为 /community_hub/video 本地视频代理(支持 Range 请求和流式传输)
|
| 386 |
+
permanent_url = f"uploads/{file_type}/{safe_filename}"
|
| 387 |
+
else:
|
| 388 |
+
permanent_url = f"https://zhiwei666-comfyui-ranking-api.hf.space/api/image_proxy?path=uploads/{file_type}/{safe_filename}"
|
| 389 |
return {"status": "success", "url": permanent_url}
|
| 390 |
|
| 391 |
|