Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import shutil
|
| 4 |
import subprocess
|
| 5 |
from pathlib import Path
|
| 6 |
|
|
@@ -17,23 +16,15 @@ 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 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
"git", "clone", "--depth", "1",
|
| 27 |
-
"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git",
|
| 28 |
-
str(RVC_DIR)
|
| 29 |
-
])
|
| 30 |
-
|
| 31 |
-
# 2. Set Python path and working directory
|
| 32 |
-
if str(RVC_DIR) not in sys.path:
|
| 33 |
-
sys.path.insert(0, str(RVC_DIR))
|
| 34 |
os.chdir(RVC_DIR)
|
| 35 |
|
| 36 |
-
#
|
| 37 |
hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
|
| 38 |
rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
|
| 39 |
|
|
@@ -42,11 +33,10 @@ if not hubert.exists() or not rmvpe.exists():
|
|
| 42 |
if downloader.exists():
|
| 43 |
run([sys.executable, str(downloader)], cwd=RVC_DIR)
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
infer_script = RVC_DIR / "infer-web.py"
|
| 47 |
run([
|
| 48 |
sys.executable,
|
| 49 |
-
|
| 50 |
"--pycmd", sys.executable,
|
| 51 |
"--port", "7860",
|
| 52 |
], cwd=RVC_DIR)
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
|
|
|
| 3 |
import subprocess
|
| 4 |
from pathlib import Path
|
| 5 |
|
|
|
|
| 16 |
print(">>>", " ".join(map(str, cmd)), flush=True)
|
| 17 |
subprocess.check_call(cmd, cwd=cwd)
|
| 18 |
|
| 19 |
+
# Verify RVC directory created during Docker build exists
|
| 20 |
if not (RVC_DIR / "infer-web.py").exists():
|
| 21 |
+
raise FileNotFoundError(f"RVC repository missing from {RVC_DIR}. Rebuild the Docker image.")
|
| 22 |
+
|
| 23 |
+
# Set execution context to RVC directory
|
| 24 |
+
sys.path.insert(0, str(RVC_DIR))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
os.chdir(RVC_DIR)
|
| 26 |
|
| 27 |
+
# Download required model assets if missing
|
| 28 |
hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
|
| 29 |
rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
|
| 30 |
|
|
|
|
| 33 |
if downloader.exists():
|
| 34 |
run([sys.executable, str(downloader)], cwd=RVC_DIR)
|
| 35 |
|
| 36 |
+
# Launch RVC WebUI
|
|
|
|
| 37 |
run([
|
| 38 |
sys.executable,
|
| 39 |
+
"infer-web.py",
|
| 40 |
"--pycmd", sys.executable,
|
| 41 |
"--port", "7860",
|
| 42 |
], cwd=RVC_DIR)
|