Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def prepare_once():
|
|
94 |
"""Clone code (skip LFS), download weights, set env, prepare dirs."""
|
95 |
_clone_without_lfs()
|
96 |
|
97 |
-
# Ensure we can import their package
|
98 |
if str(REPO_DIR) not in sys.path:
|
99 |
sys.path.insert(0, str(REPO_DIR))
|
100 |
|
@@ -113,9 +113,9 @@ def prepare_once():
|
|
113 |
|
114 |
prepare_once()
|
115 |
|
116 |
-
|
117 |
try:
|
118 |
-
import audiotools
|
119 |
except Exception as e:
|
120 |
raise RuntimeError(
|
121 |
"Missing module 'audiotools'. Install it via the PyPI package "
|
@@ -123,7 +123,17 @@ except Exception as e:
|
|
123 |
"to requirements.txt) and restart the Space."
|
124 |
) from e
|
125 |
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
from hunyuanvideo_foley.utils.model_utils import load_model, denoise_process
|
128 |
from hunyuanvideo_foley.utils.feature_utils import feature_process
|
129 |
from hunyuanvideo_foley.utils.media_utils import merge_audio_video
|
@@ -153,7 +163,7 @@ def _setup_device(device_str: str = "auto", gpu_id: int = 0) -> torch.device:
|
|
153 |
return d
|
154 |
|
155 |
def auto_load_models() -> str:
|
156 |
-
"""
|
157 |
global _model_dict, _cfg, _device
|
158 |
|
159 |
if not os.path.exists(MODEL_PATH):
|
|
|
94 |
"""Clone code (skip LFS), download weights, set env, prepare dirs."""
|
95 |
_clone_without_lfs()
|
96 |
|
97 |
+
# Ensure we can import their package later
|
98 |
if str(REPO_DIR) not in sys.path:
|
99 |
sys.path.insert(0, str(REPO_DIR))
|
100 |
|
|
|
113 |
|
114 |
prepare_once()
|
115 |
|
116 |
+
|
117 |
try:
|
118 |
+
import audiotools
|
119 |
except Exception as e:
|
120 |
raise RuntimeError(
|
121 |
"Missing module 'audiotools'. Install it via the PyPI package "
|
|
|
123 |
"to requirements.txt) and restart the Space."
|
124 |
) from e
|
125 |
|
126 |
+
try:
|
127 |
+
import omegaconf # noqa: F401
|
128 |
+
import yaml # from pyyaml
|
129 |
+
import easydict # noqa: F401
|
130 |
+
except Exception as e:
|
131 |
+
raise RuntimeError(
|
132 |
+
"Missing config deps. Please add to requirements.txt: "
|
133 |
+
"'omegaconf>=2.3.0', 'pyyaml', and 'easydict'."
|
134 |
+
) from e
|
135 |
+
|
136 |
+
# Now safe to import Tencent internals
|
137 |
from hunyuanvideo_foley.utils.model_utils import load_model, denoise_process
|
138 |
from hunyuanvideo_foley.utils.feature_utils import feature_process
|
139 |
from hunyuanvideo_foley.utils.media_utils import merge_audio_video
|
|
|
163 |
return d
|
164 |
|
165 |
def auto_load_models() -> str:
|
166 |
+
"""Load model natively (weights already downloaded to MODEL_PATH)."""
|
167 |
global _model_dict, _cfg, _device
|
168 |
|
169 |
if not os.path.exists(MODEL_PATH):
|