Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
# main.py
|
| 2 |
|
| 3 |
import os
|
|
|
|
| 4 |
from gui import get_gui
|
| 5 |
from utils import download_manager
|
| 6 |
|
|
@@ -12,21 +13,21 @@ UVR_MODELS = [
|
|
| 12 |
"UVR-MDX-NET-Inst_HQ_4.onnx",
|
| 13 |
]
|
| 14 |
|
| 15 |
-
BASE_DIR =
|
| 16 |
-
mdxnet_models_dir =
|
| 17 |
|
| 18 |
-
# Ensure mdx_models is a directory
|
| 19 |
-
if
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
# Debug: confirm visibility of data.json
|
| 24 |
-
json_path =
|
| 25 |
print("🔍 Checking for data.json at:", json_path)
|
| 26 |
-
print("📁 mdx_models contents:",
|
| 27 |
print("📂 Current working directory:", os.getcwd())
|
| 28 |
|
| 29 |
-
if not
|
| 30 |
print("❌ data.json NOT FOUND! Check if it's committed or misplaced.")
|
| 31 |
else:
|
| 32 |
print("✅ data.json found.")
|
|
@@ -35,7 +36,7 @@ else:
|
|
| 35 |
def download_models():
|
| 36 |
for model in UVR_MODELS:
|
| 37 |
url = os.path.join(MDX_DOWNLOAD_LINK, model)
|
| 38 |
-
download_manager(url, mdxnet_models_dir)
|
| 39 |
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
|
@@ -49,4 +50,4 @@ if __name__ == "__main__":
|
|
| 49 |
show_error=True,
|
| 50 |
quiet=False,
|
| 51 |
debug=False,
|
| 52 |
-
)
|
|
|
|
| 1 |
# main.py
|
| 2 |
|
| 3 |
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
from gui import get_gui
|
| 6 |
from utils import download_manager
|
| 7 |
|
|
|
|
| 13 |
"UVR-MDX-NET-Inst_HQ_4.onnx",
|
| 14 |
]
|
| 15 |
|
| 16 |
+
BASE_DIR = Path(__file__).resolve().parent
|
| 17 |
+
mdxnet_models_dir = BASE_DIR / "mdx_models"
|
| 18 |
|
| 19 |
+
# Ensure mdx_models is a directory
|
| 20 |
+
if mdxnet_models_dir.exists() and not mdxnet_models_dir.is_dir():
|
| 21 |
+
mdxnet_models_dir.unlink()
|
| 22 |
+
mdxnet_models_dir.mkdir(parents=True, exist_ok=True)
|
| 23 |
|
| 24 |
# Debug: confirm visibility of data.json
|
| 25 |
+
json_path = mdxnet_models_dir / "data.json"
|
| 26 |
print("🔍 Checking for data.json at:", json_path)
|
| 27 |
+
print("📁 mdx_models contents:", list(mdxnet_models_dir.iterdir()))
|
| 28 |
print("📂 Current working directory:", os.getcwd())
|
| 29 |
|
| 30 |
+
if not json_path.exists():
|
| 31 |
print("❌ data.json NOT FOUND! Check if it's committed or misplaced.")
|
| 32 |
else:
|
| 33 |
print("✅ data.json found.")
|
|
|
|
| 36 |
def download_models():
|
| 37 |
for model in UVR_MODELS:
|
| 38 |
url = os.path.join(MDX_DOWNLOAD_LINK, model)
|
| 39 |
+
download_manager(url, str(mdxnet_models_dir))
|
| 40 |
|
| 41 |
|
| 42 |
if __name__ == "__main__":
|
|
|
|
| 50 |
show_error=True,
|
| 51 |
quiet=False,
|
| 52 |
debug=False,
|
| 53 |
+
)
|