jacky3102 commited on
Commit
78fd7b3
·
verified ·
1 Parent(s): 42a85eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import sys
 
3
  import subprocess
4
  from pathlib import Path
5
 
@@ -16,15 +17,23 @@ def run(cmd, cwd=None):
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,7 +42,7 @@ if not hubert.exists() or not rmvpe.exists():
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",
 
1
  import os
2
  import sys
3
+ import shutil
4
  import subprocess
5
  from pathlib import Path
6
 
 
17
  print(">>>", " ".join(map(str, cmd)), flush=True)
18
  subprocess.check_call(cmd, cwd=cwd)
19
 
20
+ # 1. Guarantee RVC existence regardless of build SDK
21
  if not (RVC_DIR / "infer-web.py").exists():
22
+ print("RVC missing or incomplete. Performing clean clone...", flush=True)
23
+ if RVC_DIR.exists():
24
+ shutil.rmtree(RVC_DIR, ignore_errors=True)
25
+
26
+ run([
27
+ "git", "clone", "--depth", "1",
28
+ "https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git",
29
+ str(RVC_DIR)
30
+ ])
31
+
32
+ # 2. Set execution context
33
  sys.path.insert(0, str(RVC_DIR))
34
  os.chdir(RVC_DIR)
35
 
36
+ # 3. Download assets
37
  hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
38
  rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
39
 
 
42
  if downloader.exists():
43
  run([sys.executable, str(downloader)], cwd=RVC_DIR)
44
 
45
+ # 4. Launch RVC WebUI
46
  run([
47
  sys.executable,
48
  "infer-web.py",