mason369 commited on
Commit
4d28286
·
verified ·
1 Parent(s): 06d4236

Align HF with Gradio 4 stack

Browse files
AGENTS.md CHANGED
@@ -65,7 +65,7 @@ python -c "import torch; print(torch.cuda.is_available())"
65
  - Display name assembly: `_get_display_name()` appends `(500 epochs·40k)` style training info
66
 
67
  **UI** (`ui/app.py`):
68
- - Gradio 3.50.2, single-file ~2000 lines
69
  - i18n via `i18n/zh_CN.json`, accessed through `t(key, section)` helper
70
  - Three main tabs: song cover (full pipeline), model management, settings
71
  - Cover tab features:
@@ -116,7 +116,7 @@ python -c "import torch; print(torch.cuda.is_available())"
116
  - `fairseq` is pinned to `0.12.2` — HuBERT loading breaks on other versions
117
  - `audio-separator` must be installed with `[gpu]` extra for CUDA support
118
  - Roformer model auto-downloads on first use to `assets/separator_models/`
119
- - Gradio is pinned to `3.50.2`; the UI code uses v3 API patterns (not v4)
120
  - Model weights (.pt, .pth) and audio files are gitignored — never commit them
121
  - Path handling uses `pathlib.Path` for cross-platform compatibility (Windows/Linux)
122
  - Virtual environment activation differs by platform: `Scripts/Activate.ps1` (Windows) vs `bin/activate` (Linux)
 
65
  - Display name assembly: `_get_display_name()` appends `(500 epochs·40k)` style training info
66
 
67
  **UI** (`ui/app.py`):
68
+ - Gradio 4.44.1, single-file ~2000 lines
69
  - i18n via `i18n/zh_CN.json`, accessed through `t(key, section)` helper
70
  - Three main tabs: song cover (full pipeline), model management, settings
71
  - Cover tab features:
 
116
  - `fairseq` is pinned to `0.12.2` — HuBERT loading breaks on other versions
117
  - `audio-separator` must be installed with `[gpu]` extra for CUDA support
118
  - Roformer model auto-downloads on first use to `assets/separator_models/`
119
+ - Gradio is pinned to `4.44.1`; `huggingface_hub` is kept below 1.0 because this Gradio release still imports `HfFolder`
120
  - Model weights (.pt, .pth) and audio files are gitignored — never commit them
121
  - Path handling uses `pathlib.Path` for cross-platform compatibility (Windows/Linux)
122
  - Virtual environment activation differs by platform: `Scripts/Activate.ps1` (Windows) vs `bin/activate` (Linux)
CLAUDE.md CHANGED
@@ -65,7 +65,7 @@ python -c "import torch; print(torch.cuda.is_available())"
65
  - Display name assembly: `_get_display_name()` appends `(500 epochs·40k)` style training info
66
 
67
  **UI** (`ui/app.py`):
68
- - Gradio 3.50.2, single-file ~2000 lines
69
  - i18n via `i18n/zh_CN.json`, accessed through `t(key, section)` helper
70
  - Three main tabs: song cover (full pipeline), model management, settings
71
  - Cover tab features:
@@ -116,7 +116,7 @@ python -c "import torch; print(torch.cuda.is_available())"
116
  - `fairseq` is pinned to `0.12.2` — HuBERT loading breaks on other versions
117
  - `audio-separator` must be installed with `[gpu]` extra for CUDA support
118
  - Roformer model auto-downloads on first use to `assets/separator_models/`
119
- - Gradio is pinned to `3.50.2`; the UI code uses v3 API patterns (not v4)
120
  - Model weights (.pt, .pth) and audio files are gitignored — never commit them
121
  - Path handling uses `pathlib.Path` for cross-platform compatibility (Windows/Linux)
122
  - Virtual environment activation differs by platform: `Scripts/Activate.ps1` (Windows) vs `bin/activate` (Linux)
 
65
  - Display name assembly: `_get_display_name()` appends `(500 epochs·40k)` style training info
66
 
67
  **UI** (`ui/app.py`):
68
+ - Gradio 4.44.1, single-file ~2000 lines
69
  - i18n via `i18n/zh_CN.json`, accessed through `t(key, section)` helper
70
  - Three main tabs: song cover (full pipeline), model management, settings
71
  - Cover tab features:
 
116
  - `fairseq` is pinned to `0.12.2` — HuBERT loading breaks on other versions
117
  - `audio-separator` must be installed with `[gpu]` extra for CUDA support
118
  - Roformer model auto-downloads on first use to `assets/separator_models/`
119
+ - Gradio is pinned to `4.44.1`; `huggingface_hub` is kept below 1.0 because this Gradio release still imports `HfFolder`
120
  - Model weights (.pt, .pth) and audio files are gitignored — never commit them
121
  - Path handling uses `pathlib.Path` for cross-platform compatibility (Windows/Linux)
122
  - Virtual environment activation differs by platform: `Scripts/Activate.ps1` (Windows) vs `bin/activate` (Linux)
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🎤
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
  python_version: "3.10"
9
  app_file: app.py
10
  pinned: false
@@ -20,7 +20,7 @@ AI-RVC 是一个基于 **RVC v2** 的一键 AI 翻唱与声音转换 WebUI。上
20
  ## 功能特点
21
 
22
  - **AI 歌曲翻唱**:上传 MP3/WAV/FLAC,自动分离人声、转换音色、混合伴奏,一键生成 AI cover。
23
- - **人声分离**:默认 `audio-separator` 0.44.1 ensemble 预设(`ensemble:vocal_rvc`),可处理常见歌曲里的主唱与伴奏分离。
24
  - **音色转换**:RVC v2 架构 + FAISS 检索增强流程,搭配角色模型完成声线转换。
25
  - **RMVPE 音高提取**:用于提取 F0 基频曲线,让旋律和音高更稳。
26
  - **角色模型**:内置 117 个可下载角色模型,支持系列筛选和关键词搜索。
 
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.44.1
8
  python_version: "3.10"
9
  app_file: app.py
10
  pinned: false
 
20
  ## 功能特点
21
 
22
  - **AI 歌曲翻唱**:上传 MP3/WAV/FLAC,自动分离人声、转换音色、混合伴奏,一键生成 AI cover。
23
+ - **人声分离**:默认 `audio-separator` 0.44.1 ensemble 预设(`ensemble:vocal_rvc`),配合 Gradio 4 / NumPy 2 运行,可处理常见歌曲里的主唱与伴奏分离。
24
  - **音色转换**:RVC v2 架构 + FAISS 检索增强流程,搭配角色模型完成声线转换。
25
  - **RMVPE 音高提取**:用于提取 F0 基频曲线,让旋律和音高更稳。
26
  - **角色模型**:内置 117 个可下载角色模型,支持系列筛选和关键词搜索。
README_HF.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🎤
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
  python_version: "3.10"
9
  app_file: app.py
10
  pinned: false
@@ -20,7 +20,7 @@ AI-RVC 是一个基于 **RVC v2** 的一键 AI 翻唱与声音转换 WebUI。上
20
  ## 功能特点
21
 
22
  - **AI 歌曲翻唱**:上传 MP3/WAV/FLAC,自动分离人声、转换音色、混合伴奏,一键生成 AI cover。
23
- - **人声分离**:默认 `audio-separator` 0.44.1 ensemble 预设(`ensemble:vocal_rvc`),可处理常见歌曲里的主唱与伴奏分离。
24
  - **音色转换**:RVC v2 架构 + FAISS 检索增强流程,搭配角色模型完成声线转换。
25
  - **RMVPE 音高提取**:用于提取 F0 基频曲线,让旋律和音高更稳。
26
  - **角色模型**:内置 117 个可下载角色模型,支持系列筛选和关键词搜索。
 
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.44.1
8
  python_version: "3.10"
9
  app_file: app.py
10
  pinned: false
 
20
  ## 功能特点
21
 
22
  - **AI 歌曲翻唱**:上传 MP3/WAV/FLAC,自动分离人声、转换音色、混合伴奏,一键生成 AI cover。
23
+ - **人声分离**:默认 `audio-separator` 0.44.1 ensemble 预设(`ensemble:vocal_rvc`),配合 Gradio 4 / NumPy 2 运行,可处理常见歌曲里的主唱与伴奏分离。
24
  - **音色转换**:RVC v2 架构 + FAISS 检索增强流程,搭配角色模型完成声线转换。
25
  - **RMVPE 音高提取**:用于提取 F0 基频曲线,让旋律和音高更稳。
26
  - **角色模型**:内置 117 个可下载角色模型,支持系列筛选和关键词搜索。
i18n/en_US.json CHANGED
@@ -131,7 +131,7 @@
131
  "language": "Interface Language",
132
  "save_language": "Save Language",
133
  "language_saved_restart": "✅ Interface language saved: {language}. Please restart the app for it to take effect.",
134
- "language_restart_info": "The language choice is saved to the config file. Because Gradio 3 builds UI labels at startup, restart the app to apply it.",
135
  "runtime_settings": "Runtime Settings",
136
  "compute_device": "Compute Device",
137
  "save_settings": "Save Settings",
 
131
  "language": "Interface Language",
132
  "save_language": "Save Language",
133
  "language_saved_restart": "✅ Interface language saved: {language}. Please restart the app for it to take effect.",
134
+ "language_restart_info": "The language choice is saved to the config file. Because Gradio builds UI labels at startup, restart the app to apply it.",
135
  "runtime_settings": "Runtime Settings",
136
  "compute_device": "Compute Device",
137
  "save_settings": "Save Settings",
i18n/zh_CN.json CHANGED
@@ -131,7 +131,7 @@
131
  "language": "界面语言",
132
  "save_language": "保存语言",
133
  "language_saved_restart": "✅ 已保存界面语言:{language}。请重启应用后生效。",
134
- "language_restart_info": "切换语言会保存到配置文件;由于 Gradio 3 的界面文案在启动时生成,重启后生效。",
135
  "runtime_settings": "运行设置",
136
  "compute_device": "计算设备",
137
  "save_settings": "保存设置",
 
131
  "language": "界面语言",
132
  "save_language": "保存语言",
133
  "language_saved_restart": "✅ 已保存界面语言:{language}。请重启应用后生效。",
134
+ "language_restart_info": "切换语言会保存到配置文件;由于 Gradio 界面文案在启动时生成,重启后生效。",
135
  "runtime_settings": "运行设置",
136
  "compute_device": "计算设备",
137
  "save_settings": "保存设置",
install.py CHANGED
@@ -27,7 +27,7 @@ PYTHON310_CANDIDATES = [
27
  PACKAGES = {
28
  "torch": {"import": "torch", "name": "PyTorch", "pip": "torch"},
29
  "torchaudio": {"import": "torchaudio", "name": "torchaudio", "pip": "torchaudio"},
30
- "gradio": {"import": "gradio", "name": "Gradio", "pip": "gradio==3.50.2"},
31
  "librosa": {"import": "librosa", "name": "librosa", "pip": "librosa"},
32
  "soundfile": {"import": "soundfile", "name": "soundfile", "pip": "soundfile"},
33
  "av": {"import": "av", "name": "PyAV", "pip": "av"},
@@ -35,10 +35,10 @@ PACKAGES = {
35
  "numpy": {
36
  "import": "numpy",
37
  "name": "numpy",
38
- "pip": "numpy<2,>=1.23.0",
39
  "dist": "numpy",
40
- "min_version": "1.23.0",
41
- "max_exclusive_version": "2.0.0",
42
  },
43
  "parselmouth": {"import": "parselmouth", "name": "praat-parselmouth", "pip": "praat-parselmouth"},
44
  "pyworld": {"import": "pyworld", "name": "pyworld", "pip": "pyworld"},
@@ -321,12 +321,6 @@ def install_all(venv_py, gpu=True):
321
  extra="gpu" if gpu else "cpu",
322
  version_spec=version_spec,
323
  )
324
- if ok:
325
- # audio-separator 0.31+ declares numpy>=2, while the current
326
- # Gradio 3.x UI stack is pinned to numpy 1.x. The separator
327
- # model table and runtime imports work with numpy 1.26, so
328
- # restore the app-compatible numpy line after separator install.
329
- ok = pip_install(venv_py, "numpy<2,>=1.23.0")
330
  else:
331
  ok = pip_install(venv_py, pip_name)
332
  if not ok:
 
27
  PACKAGES = {
28
  "torch": {"import": "torch", "name": "PyTorch", "pip": "torch"},
29
  "torchaudio": {"import": "torchaudio", "name": "torchaudio", "pip": "torchaudio"},
30
+ "gradio": {"import": "gradio", "name": "Gradio", "pip": "gradio==4.44.1"},
31
  "librosa": {"import": "librosa", "name": "librosa", "pip": "librosa"},
32
  "soundfile": {"import": "soundfile", "name": "soundfile", "pip": "soundfile"},
33
  "av": {"import": "av", "name": "PyAV", "pip": "av"},
 
35
  "numpy": {
36
  "import": "numpy",
37
  "name": "numpy",
38
+ "pip": "numpy>=2,<3",
39
  "dist": "numpy",
40
+ "min_version": "2.0.0",
41
+ "max_exclusive_version": "3.0.0",
42
  },
43
  "parselmouth": {"import": "parselmouth", "name": "praat-parselmouth", "pip": "praat-parselmouth"},
44
  "pyworld": {"import": "pyworld", "name": "pyworld", "pip": "pyworld"},
 
321
  extra="gpu" if gpu else "cpu",
322
  version_spec=version_spec,
323
  )
 
 
 
 
 
 
324
  else:
325
  ok = pip_install(venv_py, pip_name)
326
  if not ok:
requirements.txt CHANGED
@@ -7,19 +7,18 @@ torch>=2.0.0
7
  torchaudio>=2.0.0
8
 
9
  # Gradio 界面
10
- gradio==3.50.2
11
- fastapi==0.104.1
12
- starlette==0.27.0
13
- anyio<4
14
- pydantic<2
15
- jinja2<3.1
16
- pandas<2
17
 
18
  # 音频处理
19
  librosa>=0.9.0
20
  soundfile>=0.12.0
21
  scipy>=1.10.0
22
- numpy<2,>=1.23.0
23
  praat-parselmouth>=0.4.3
24
  torchcrepe>=0.0.20
25
 
@@ -34,7 +33,7 @@ colorama>=0.4.6
34
 
35
  # AI 翻唱功能(核心)
36
  audio-separator==0.44.1
37
- huggingface_hub>=0.19.0
38
  pedalboard>=0.7.0
39
  ffmpeg-python>=0.2.0
40
 
 
7
  torchaudio>=2.0.0
8
 
9
  # Gradio 界面
10
+ gradio==4.44.1
11
+ fastapi>=0.115,<1
12
+ anyio>=3,<5
13
+ pydantic>=2,<3
14
+ jinja2>=3.1,<4
15
+ pandas>=2,<3
 
16
 
17
  # 音频处理
18
  librosa>=0.9.0
19
  soundfile>=0.12.0
20
  scipy>=1.10.0
21
+ numpy>=2,<3
22
  praat-parselmouth>=0.4.3
23
  torchcrepe>=0.0.20
24
 
 
33
 
34
  # AI 翻唱功能(核心)
35
  audio-separator==0.44.1
36
+ huggingface_hub>=0.19.0,<1.0
37
  pedalboard>=0.7.0
38
  ffmpeg-python>=0.2.0
39
 
requirements_hf.txt CHANGED
@@ -7,19 +7,18 @@ torch>=2.0.0
7
  torchaudio>=2.0.0
8
 
9
  # Gradio 界面
10
- gradio==3.50.2
11
- fastapi==0.104.1
12
- starlette==0.27.0
13
- anyio<4
14
- pydantic<2
15
- jinja2<3.1
16
- pandas<2
17
 
18
  # 音频处理
19
  librosa>=0.9.0
20
  soundfile>=0.12.0
21
  scipy>=1.10.0
22
- numpy<2,>=1.23.0
23
  praat-parselmouth>=0.4.3
24
  torchcrepe>=0.0.20
25
 
@@ -34,7 +33,7 @@ colorama>=0.4.6
34
 
35
  # AI 翻唱功能(核心)
36
  audio-separator==0.44.1
37
- huggingface_hub>=0.19.0
38
  pedalboard>=0.7.0
39
  ffmpeg-python>=0.2.0
40
 
 
7
  torchaudio>=2.0.0
8
 
9
  # Gradio 界面
10
+ gradio==4.44.1
11
+ fastapi>=0.115,<1
12
+ anyio>=3,<5
13
+ pydantic>=2,<3
14
+ jinja2>=3.1,<4
15
+ pandas>=2,<3
 
16
 
17
  # 音频处理
18
  librosa>=0.9.0
19
  soundfile>=0.12.0
20
  scipy>=1.10.0
21
+ numpy>=2,<3
22
  praat-parselmouth>=0.4.3
23
  torchcrepe>=0.0.20
24
 
 
33
 
34
  # AI 翻唱功能(核心)
35
  audio-separator==0.44.1
36
+ huggingface_hub>=0.19.0,<1.0
37
  pedalboard>=0.7.0
38
  ffmpeg-python>=0.2.0
39
 
tests/test_hf_entrypoint.py CHANGED
@@ -28,20 +28,19 @@ class HuggingFaceEntrypointTests(unittest.TestCase):
28
 
29
  self.assertIn('python_version: "3.10"', readme)
30
 
31
- def test_space_requirements_keep_gradio_3_compatibility_pins(self):
32
  requirements = (REPO_ROOT / "requirements_hf.txt").read_text(
33
  encoding="utf-8"
34
  )
35
 
36
- self.assertIn("gradio==3.50.2", requirements)
37
- self.assertIn("fastapi==0.104.1", requirements)
38
- self.assertIn("starlette==0.27.0", requirements)
39
- self.assertIn("anyio<4", requirements)
40
- self.assertIn("pydantic<2", requirements)
41
- self.assertIn("jinja2<3.1", requirements)
42
- self.assertIn("pandas<2", requirements)
43
- self.assertIn("numpy<2,>=1.23.0", requirements)
44
  self.assertIn("audio-separator==0.44.1", requirements)
 
45
 
46
 
47
  if __name__ == "__main__":
 
28
 
29
  self.assertIn('python_version: "3.10"', readme)
30
 
31
+ def test_space_requirements_keep_gradio_4_audio_separator_pins(self):
32
  requirements = (REPO_ROOT / "requirements_hf.txt").read_text(
33
  encoding="utf-8"
34
  )
35
 
36
+ self.assertIn("gradio==4.44.1", requirements)
37
+ self.assertIn("fastapi>=0.115,<1", requirements)
38
+ self.assertIn("pydantic>=2,<3", requirements)
39
+ self.assertIn("jinja2>=3.1,<4", requirements)
40
+ self.assertIn("pandas>=2,<3", requirements)
41
+ self.assertIn("numpy>=2,<3", requirements)
 
 
42
  self.assertIn("audio-separator==0.44.1", requirements)
43
+ self.assertIn("huggingface_hub>=0.19.0,<1.0", requirements)
44
 
45
 
46
  if __name__ == "__main__":
tests/test_install_requirements.py CHANGED
@@ -33,10 +33,10 @@ class InstallRequirementTests(unittest.TestCase):
33
  {info["pip"] for info in missing},
34
  )
35
 
36
- def test_numpy_2_is_marked_for_downgrade(self):
37
  def version_for_package(_venv_py, distribution_name):
38
  if distribution_name == "numpy":
39
- return "2.2.6"
40
  if distribution_name == "audio-separator":
41
  return "0.44.1"
42
  return None
@@ -48,9 +48,9 @@ class InstallRequirementTests(unittest.TestCase):
48
  ), contextlib.redirect_stdout(io.StringIO()):
49
  missing = install.check_all("python")
50
 
51
- self.assertIn("numpy<2,>=1.23.0", {info["pip"] for info in missing})
52
 
53
- def test_audio_separator_install_restores_numpy_1_x(self):
54
  audio_separator_info = install.PACKAGES["audio_separator"]
55
  calls = []
56
 
@@ -67,9 +67,15 @@ class InstallRequirementTests(unittest.TestCase):
67
  ok = install.install_all("python", gpu=False)
68
 
69
  self.assertTrue(ok)
70
- self.assertEqual(calls[0][0], "audio-separator")
71
- self.assertEqual(calls[0][1]["version_spec"], ">=0.44.1")
72
- self.assertIn(("numpy<2,>=1.23.0", {}), calls)
 
 
 
 
 
 
73
 
74
  def test_cuda_13_uses_latest_supported_pytorch_wheel(self):
75
  def fake_run(cmd, **_kwargs):
 
33
  {info["pip"] for info in missing},
34
  )
35
 
36
+ def test_numpy_1_is_marked_for_upgrade(self):
37
  def version_for_package(_venv_py, distribution_name):
38
  if distribution_name == "numpy":
39
+ return "1.26.4"
40
  if distribution_name == "audio-separator":
41
  return "0.44.1"
42
  return None
 
48
  ), contextlib.redirect_stdout(io.StringIO()):
49
  missing = install.check_all("python")
50
 
51
+ self.assertIn("numpy>=2,<3", {info["pip"] for info in missing})
52
 
53
+ def test_audio_separator_install_keeps_declared_numpy_2_stack(self):
54
  audio_separator_info = install.PACKAGES["audio_separator"]
55
  calls = []
56
 
 
67
  ok = install.install_all("python", gpu=False)
68
 
69
  self.assertTrue(ok)
70
+ self.assertEqual(
71
+ calls,
72
+ [
73
+ (
74
+ "audio-separator",
75
+ {"extra": "cpu", "version_spec": ">=0.44.1"},
76
+ )
77
+ ],
78
+ )
79
 
80
  def test_cuda_13_uses_latest_supported_pytorch_wheel(self):
81
  def fake_run(cmd, **_kwargs):
ui/app.py CHANGED
@@ -1221,7 +1221,7 @@ div[data-testid="dropdown"] svg,
1221
  color: #9e9e9e !important;
1222
  }
1223
 
1224
- /* Gradio 3.x 特定选择器样式 */
1225
  .wrap.svelte-1m1zvyj,
1226
  .wrap-inner.svelte-1m1zvyj,
1227
  .secondary-wrap.svelte-1m1zvyj {
 
1221
  color: #9e9e9e !important;
1222
  }
1223
 
1224
+ /* Gradio 3/4 selector compatibility */
1225
  .wrap.svelte-1m1zvyj,
1226
  .wrap-inner.svelte-1m1zvyj,
1227
  .secondary-wrap.svelte-1m1zvyj {