Spaces:
Runtime error
Runtime error
Update hf_space/app.py
Browse files- hf_space/app.py +19 -1
hf_space/app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import sys
|
| 3 |
from pathlib import Path
|
| 4 |
|
|
@@ -35,9 +36,26 @@ if weights_repo:
|
|
| 35 |
)
|
| 36 |
|
| 37 |
# Ensure expected runtime directories exist so the demo can write outputs.
|
| 38 |
-
|
|
|
|
| 39 |
(BASE_DIR / relative).mkdir(parents=True, exist_ok=True)
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# Reuse the existing Gradio interface defined in demo.py.
|
| 42 |
from demo import demo as gesture_demo # noqa: E402
|
| 43 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
import shutil
|
| 3 |
import sys
|
| 4 |
from pathlib import Path
|
| 5 |
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
# Ensure expected runtime directories exist so the demo can write outputs.
|
| 39 |
+
datasets_hub_dir = BASE_DIR / "datasets" / "hub"
|
| 40 |
+
for relative in ["outputs/audio2pose", "datasets/BEAT_SMPL", "datasets/hub"]:
|
| 41 |
(BASE_DIR / relative).mkdir(parents=True, exist_ok=True)
|
| 42 |
|
| 43 |
+
smplx_dest = datasets_hub_dir / "smplx_models"
|
| 44 |
+
smplx_dest.mkdir(parents=True, exist_ok=True)
|
| 45 |
+
|
| 46 |
+
if not any(smplx_dest.iterdir()):
|
| 47 |
+
smplx_sources = list(CKPT_DIR.glob("**/smplx_models"))
|
| 48 |
+
if smplx_sources:
|
| 49 |
+
smplx_source = smplx_sources[0]
|
| 50 |
+
for item in smplx_source.iterdir():
|
| 51 |
+
target = smplx_dest / item.name
|
| 52 |
+
if item.is_dir():
|
| 53 |
+
shutil.copytree(item, target, dirs_exist_ok=True)
|
| 54 |
+
else:
|
| 55 |
+
shutil.copy2(item, target)
|
| 56 |
+
else:
|
| 57 |
+
print("[GestureLSM] WARNING: smplx_models directory missing; ensure the weights repo contains it.")
|
| 58 |
+
|
| 59 |
# Reuse the existing Gradio interface defined in demo.py.
|
| 60 |
from demo import demo as gesture_demo # noqa: E402
|
| 61 |
|