wangyiyi666 commited on
Commit
bd7d05c
·
verified ·
1 Parent(s): f593a49

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -98,9 +98,11 @@ def check_status(task_id):
98
  try:
99
  files = list_repo_files(REPO_ID, repo_type=REPO_TYPE, token=HF_TOKEN)
100
 
101
- # 检查 outbox 是否有结果: outbox/{task_id}.glb
102
- result_path = f"outbox/{task_id}.glb"
103
- if result_path in files:
 
 
104
  download_url = f"https://huggingface.co/datasets/{REPO_ID}/resolve/main/{result_path}"
105
  log(f"任务 {task_id} 已完成")
106
  return (
@@ -108,7 +110,7 @@ def check_status(task_id):
108
  f"| 项目 | 信息 |\n"
109
  f"|------|------|\n"
110
  f"| 📋 任务ID | `{task_id}` |\n"
111
- f"| 📄 格式 | GLB |\n\n"
112
  f"> 👇 [点击此处下载优化后的模型]({download_url})"
113
  )
114
 
@@ -212,6 +214,9 @@ with gr.Blocks(
212
  <span style="margin: 0 8px; color: #999;">→</span>
213
  <span class="format-badge" style="background: #e8f5e9; color: #2e7d32;">GLB 输出</span>
214
  </div>
 
 
 
215
  """)
216
 
217
  with gr.Tabs():
 
98
  try:
99
  files = list_repo_files(REPO_ID, repo_type=REPO_TYPE, token=HF_TOKEN)
100
 
101
+ # 检查 outbox 是否有结果: outbox/{task_id}.xxx(保持原始格式)
102
+ outbox_matches = [f for f in files if f.startswith(f"outbox/{task_id}") and not f.endswith('.json')]
103
+ if outbox_matches:
104
+ result_path = outbox_matches[0]
105
+ ext = os.path.splitext(result_path)[1].upper().lstrip('.')
106
  download_url = f"https://huggingface.co/datasets/{REPO_ID}/resolve/main/{result_path}"
107
  log(f"任务 {task_id} 已完成")
108
  return (
 
110
  f"| 项目 | 信息 |\n"
111
  f"|------|------|\n"
112
  f"| 📋 任务ID | `{task_id}` |\n"
113
+ f"| 📄 格式 | {ext} |\n\n"
114
  f"> 👇 [点击此处下载优化后的模型]({download_url})"
115
  )
116
 
 
214
  <span style="margin: 0 8px; color: #999;">→</span>
215
  <span class="format-badge" style="background: #e8f5e9; color: #2e7d32;">GLB 输出</span>
216
  </div>
217
+ <div style="text-align: center; margin-bottom: 16px; padding: 8px 16px; background: #fff3cd; border-radius: 8px; color: #856404; font-size: 14px;">
218
+ ⚠️ 测试阶段,请优先上传 GLB 格式文件
219
+ </div>
220
  """)
221
 
222
  with gr.Tabs():