Jacky2305 commited on
Commit
ddc16e7
·
1 Parent(s): 1dadae0

Add auto-download of OldChineseMan RVC model from model repo

Browse files
Files changed (2) hide show
  1. app.py +21 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -45,7 +45,27 @@ for asset_dir in [
45
  ]:
46
  asset_dir.mkdir(parents=True, exist_ok=True)
47
 
48
- # 4. Launch RVC WebUI (webui.py is the new entry point)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  run([
50
  sys.executable,
51
  "webui.py",
 
45
  ]:
46
  asset_dir.mkdir(parents=True, exist_ok=True)
47
 
48
+ # 4. Download OldChineseMan RVC model from model repo
49
+ from huggingface_hub import hf_hub_download
50
+
51
+ model_repo = "jacky3102/OldChineseMan_RVC"
52
+ weights_dir = RVC_DIR / "assets" / "weights"
53
+ indices_dir = RVC_DIR / "assets" / "indices"
54
+
55
+ for fname in ["OldChineseMan.pth", "added_IVF24_Flat_nprobe_1_OldChineseMan_v2.index"]:
56
+ target = weights_dir / fname if fname.endswith(".pth") else indices_dir / fname
57
+ if not target.exists():
58
+ print(f"Downloading {fname} from {model_repo}...", flush=True)
59
+ hf_hub_download(
60
+ repo_id=model_repo,
61
+ filename=fname,
62
+ local_dir=weights_dir if fname.endswith(".pth") else indices_dir,
63
+ local_dir_use_symlinks=False,
64
+ )
65
+ else:
66
+ print(f"{fname} already exists, skipping.", flush=True)
67
+
68
+ # 5. Launch RVC WebUI (webui.py is the new entry point)
69
  run([
70
  sys.executable,
71
  "webui.py",
requirements.txt CHANGED
@@ -36,6 +36,7 @@ transformers>=4.49.0,<4.50
36
 
37
  # Gradio 3.14 API compatibility (RVC WebUI requires Gradio 3.14.x)
38
  gradio>=3.14.0,<3.15
 
39
  altair>=4.2.0,<5
40
  anyio>=3.6.2,<4
41
  fastapi>=0.88.0,<0.100
 
36
 
37
  # Gradio 3.14 API compatibility (RVC WebUI requires Gradio 3.14.x)
38
  gradio>=3.14.0,<3.15
39
+ huggingface_hub>=0.24.0
40
  altair>=4.2.0,<5
41
  anyio>=3.6.2,<4
42
  fastapi>=0.88.0,<0.100