Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -842,7 +842,7 @@ def sync_ui_assets():
|
|
| 842 |
print(f"🔄 正在从 {UI_SPACE_URL} 同步前端文件到 /frontend_cache...")
|
| 843 |
for f in files_to_sync:
|
| 844 |
try:
|
| 845 |
-
res = requests.get(f"{UI_SPACE_URL}/{f}?t={int(time.time())}", timeout=10)
|
| 846 |
if res.status_code == 200:
|
| 847 |
(FRONTEND_CACHE_DIR / f).write_text(res.text, encoding="utf-8")
|
| 848 |
print(f"✅ 已更新: {f}")
|
|
@@ -874,8 +874,6 @@ else:
|
|
| 874 |
if __name__ == "__main__":
|
| 875 |
os.environ["GRADIO_SSR_MODE"] = "false"
|
| 876 |
|
| 877 |
-
# 1. 先同步前端文件(阻塞执行)
|
| 878 |
-
sync_ui_assets()
|
| 879 |
|
| 880 |
# 2. 启动 ZeroGPU 探针
|
| 881 |
def trigger_gpu_scan():
|
|
|
|
| 842 |
print(f"🔄 正在从 {UI_SPACE_URL} 同步前端文件到 /frontend_cache...")
|
| 843 |
for f in files_to_sync:
|
| 844 |
try:
|
| 845 |
+
res = requests.get(f"{UI_SPACE_URL}/{f.lstrip('/')}?t={int(time.time())}", timeout=10)
|
| 846 |
if res.status_code == 200:
|
| 847 |
(FRONTEND_CACHE_DIR / f).write_text(res.text, encoding="utf-8")
|
| 848 |
print(f"✅ 已更新: {f}")
|
|
|
|
| 874 |
if __name__ == "__main__":
|
| 875 |
os.environ["GRADIO_SSR_MODE"] = "false"
|
| 876 |
|
|
|
|
|
|
|
| 877 |
|
| 878 |
# 2. 启动 ZeroGPU 探针
|
| 879 |
def trigger_gpu_scan():
|