Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import shutil
|
|
| 4 |
import subprocess
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
-
#
|
| 8 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
| 9 |
os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
|
| 10 |
os.environ["GRADIO_SERVER_PORT"] = "7860"
|
|
@@ -17,7 +17,7 @@ def run(cmd, cwd=None):
|
|
| 17 |
print(">>>", " ".join(map(str, cmd)), flush=True)
|
| 18 |
subprocess.check_call(cmd, cwd=cwd)
|
| 19 |
|
| 20 |
-
#
|
| 21 |
if not (RVC_DIR / "infer-web.py").exists():
|
| 22 |
if RVC_DIR.exists():
|
| 23 |
shutil.rmtree(RVC_DIR)
|
|
@@ -28,11 +28,11 @@ if not (RVC_DIR / "infer-web.py").exists():
|
|
| 28 |
str(RVC_DIR)
|
| 29 |
])
|
| 30 |
|
| 31 |
-
#
|
| 32 |
sys.path.insert(0, str(RVC_DIR))
|
| 33 |
os.chdir(RVC_DIR)
|
| 34 |
|
| 35 |
-
#
|
| 36 |
hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
|
| 37 |
rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
|
| 38 |
|
|
@@ -41,10 +41,10 @@ if not hubert.exists() or not rmvpe.exists():
|
|
| 41 |
if downloader.exists():
|
| 42 |
run([sys.executable, str(downloader)], cwd=RVC_DIR)
|
| 43 |
|
| 44 |
-
#
|
| 45 |
run([
|
| 46 |
sys.executable,
|
| 47 |
"infer-web.py",
|
| 48 |
"--pycmd", sys.executable,
|
| 49 |
"--port", "7860",
|
| 50 |
-
]
|
|
|
|
| 4 |
import subprocess
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
+
# Hugging Face Spaces / CPU-only environment setup
|
| 8 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
| 9 |
os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
|
| 10 |
os.environ["GRADIO_SERVER_PORT"] = "7860"
|
|
|
|
| 17 |
print(">>>", " ".join(map(str, cmd)), flush=True)
|
| 18 |
subprocess.check_call(cmd, cwd=cwd)
|
| 19 |
|
| 20 |
+
# Force-clean any empty or broken /app/rvc folder before cloning
|
| 21 |
if not (RVC_DIR / "infer-web.py").exists():
|
| 22 |
if RVC_DIR.exists():
|
| 23 |
shutil.rmtree(RVC_DIR)
|
|
|
|
| 28 |
str(RVC_DIR)
|
| 29 |
])
|
| 30 |
|
| 31 |
+
# Set working directory to RVC root
|
| 32 |
sys.path.insert(0, str(RVC_DIR))
|
| 33 |
os.chdir(RVC_DIR)
|
| 34 |
|
| 35 |
+
# Download required model assets if missing
|
| 36 |
hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
|
| 37 |
rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
|
| 38 |
|
|
|
|
| 41 |
if downloader.exists():
|
| 42 |
run([sys.executable, str(downloader)], cwd=RVC_DIR)
|
| 43 |
|
| 44 |
+
# Launch RVC WebUI directly from the current working directory
|
| 45 |
run([
|
| 46 |
sys.executable,
|
| 47 |
"infer-web.py",
|
| 48 |
"--pycmd", sys.executable,
|
| 49 |
"--port", "7860",
|
| 50 |
+
])
|