David Thomas commited on
Commit
c63164d
·
1 Parent(s): 4f473c9
Files changed (4) hide show
  1. .gitignore +18 -0
  2. app.py +99 -65
  3. gitignore.txt +7 -1
  4. utils.py +2 -1
.gitignore ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ weights/
3
+ TEMP/
4
+ logs/
5
+ csvdb/
6
+
7
+ # Environments
8
+ .env
9
+ .venv
10
+ env/
11
+ venv/
12
+ ENV/
13
+ env.bak/
14
+ venv.bak/
15
+
16
+ # Models
17
+ hubert_base.pt
18
+ rmvpe.pt
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import subprocess, torch, os, traceback, sys, warnings, shutil, numpy as np
2
- from mega import Mega
3
  os.environ["no_proxy"] = "localhost, 127.0.0.1, ::1"
4
  import threading
5
  from time import sleep
@@ -160,7 +160,7 @@ def update_fshift_presets(preset, qfrency, tmbre):
160
 
161
  i18n = I18nAuto()
162
  #i18n.print()
163
- # 判断是否有能用来训练和加速推理的N
164
  ngpu = torch.cuda.device_count()
165
  gpu_infos = []
166
  mem = []
@@ -244,14 +244,8 @@ def load_hubert():
244
  weight_root = "weights"
245
  index_root = "logs"
246
  names = []
247
- for name in os.listdir(weight_root):
248
- if name.endswith(".pth"):
249
- names.append(name)
250
- index_paths = []
251
- for root, dirs, files in os.walk(index_root, topdown=False):
252
- for name in files:
253
- if name.endswith(".index") and "trained" not in name:
254
- index_paths.append("%s/%s" % (root, name))
255
 
256
 
257
 
@@ -277,13 +271,15 @@ def vc_single(
277
  f0_up_key = int(f0_up_key)
278
  try:
279
  audio = load_audio(input_audio_path, 16000, DoFormant, Quefrency, Timbre)
 
280
  audio_max = np.abs(audio).max() / 0.95
281
  if audio_max > 1:
282
  audio /= audio_max
283
  times = [0, 0, 0]
284
- if hubert_model == None:
285
  load_hubert()
286
  if_f0 = cpt.get("f0", 1)
 
287
  file_index = (
288
  (
289
  file_index.strip(" ")
@@ -293,7 +289,9 @@ def vc_single(
293
  .strip(" ")
294
  .replace("trained", "added")
295
  )
296
- ) # 防止小白写错,自动帮他替换掉
 
 
297
  # file_big_npy = (
298
  # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
299
  # )
@@ -359,7 +357,8 @@ def vc_multi(
359
  try:
360
  dir_path = (
361
  dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
362
- ) # 防止小白拷路径头尾带了空格和"和回车
 
363
  opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
364
  os.makedirs(opt_root, exist_ok=True)
365
  try:
@@ -416,12 +415,14 @@ def vc_multi(
416
  except:
417
  yield traceback.format_exc()
418
 
419
- # 一个选项卡全局只能有一个音色
420
- def get_vc(sid):
421
  global n_spk, tgt_sr, net_g, vc, cpt, version
422
  if sid == "" or sid == []:
423
  global hubert_model
424
- if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
 
 
425
  print("clean_empty_cache")
426
  del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
427
  hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
@@ -1257,7 +1258,7 @@ def change_choices2():
1257
  audio_files=[]
1258
  for filename in os.listdir("./audios"):
1259
  if filename.endswith(('.wav','.mp3','.ogg','.flac','.m4a','.aac','.mp4')):
1260
- audio_files.append(os.path.join('./audios',filename).replace('\\', '/'))
1261
 
1262
  def get_index():
1263
  if check_for_name() != '':
@@ -1304,15 +1305,15 @@ def save_to_wav2(dropbox):
1304
  return os.path.join('./audios',os.path.basename(file_path))
1305
 
1306
  def match_index(sid0):
1307
- folder=sid0.split(".")[0]
1308
- parent_dir="./logs/"+folder
1309
- if os.path.exists(parent_dir):
1310
- for filename in os.listdir(parent_dir):
1311
- if filename.endswith(".index"):
1312
- index_path=os.path.join(parent_dir,filename)
1313
- return index_path
1314
- else:
1315
- return ''
1316
 
1317
  def check_for_name():
1318
  if len(names) > 0:
@@ -1337,9 +1338,9 @@ def download_from_url(url, model):
1337
  try:
1338
  if "drive.google.com" in url:
1339
  subprocess.run(["gdown", url, "--fuzzy", "-O", zipfile_path])
1340
- elif "mega.nz" in url:
1341
- m = Mega()
1342
- m.download_url(url, './zips')
1343
  else:
1344
  subprocess.run(["wget", url, "-O", zipfile_path])
1345
  for filename in os.listdir("./zips"):
@@ -1470,12 +1471,17 @@ def zip_downloader(model):
1470
  else:
1471
  return f'./weights/{model}.pth', "Could not find Index file."
1472
 
1473
- with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
 
1474
  with gr.Tabs():
1475
  with gr.TabItem("Inference"):
1476
- gr.HTML("<h1> RVC V2 Huggingface Version </h1>")
1477
- gr.HTML("<h10> Huggingface version made by Clebersla </h10>")
1478
- gr.HTML("<h4> If you want to use this space privately, I recommend you duplicate the space. </h4>")
 
 
 
 
1479
 
1480
  # Inference Preset Row
1481
  # with gr.Row():
@@ -1487,17 +1493,17 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1487
 
1488
  # Other RVC stuff
1489
  with gr.Row():
1490
- sid0 = gr.Dropdown(label="1.Choose your Model.", choices=sorted(names), value=check_for_name())
1491
  refresh_button = gr.Button("Refresh", variant="primary")
1492
  if check_for_name() != '':
1493
  get_vc(sorted(names)[0])
1494
  vc_transform0 = gr.Number(label="Optional: You can change the pitch here or leave it at 0.", value=0)
1495
- #clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
1496
  spk_item = gr.Slider(
1497
  minimum=0,
1498
  maximum=2333,
1499
  step=1,
1500
- label=i18n("请选择说话人id"),
1501
  value=0,
1502
  visible=False,
1503
  interactive=True,
@@ -1526,7 +1532,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1526
  refresh_button2 = gr.Button("Refresh", variant="primary", size='sm')
1527
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1528
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1529
- with gr.Row():
1530
  with gr.Accordion('Text To Speech', open=False):
1531
  with gr.Column():
1532
  lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['en','es','fr','pt','zh-CN','de','hi','ja'], value='en')
@@ -1549,14 +1555,14 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1549
  animation = gr.Video(type='filepath')
1550
  refresh_button2.click(fn=change_choices2, inputs=[], outputs=[input_audio0, animation])
1551
  with gr.Row():
1552
- animate_button = gr.Button('Animate')
1553
 
1554
  with gr.Column():
1555
  with gr.Accordion("Index Settings", open=False):
1556
  file_index1 = gr.Dropdown(
1557
  label="3. Path to your added.index file (if it didn't automatically find it.)",
1558
- choices=get_indexes(),
1559
- value=get_index(),
1560
  interactive=True,
1561
  )
1562
  sid0.change(fn=match_index, inputs=[sid0],outputs=[file_index1])
@@ -1571,7 +1577,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1571
  index_rate1 = gr.Slider(
1572
  minimum=0,
1573
  maximum=1,
1574
- label=i18n("检索特征占比"),
1575
  value=0.66,
1576
  interactive=True,
1577
  )
@@ -1580,7 +1586,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1580
  type='filepath',
1581
  interactive=False,
1582
  )
1583
- animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1584
  with gr.Accordion("Advanced Settings", open=False):
1585
  f0method0 = gr.Radio(
1586
  label="Optional: Change the Pitch Extraction Algorithm.\nExtraction methods are sorted from 'worst quality' to 'best quality'.\nmangio-crepe may or may not be better than rmvpe in cases where 'smoothness' is more important, but rmvpe is the best overall.",
@@ -1602,7 +1608,8 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1602
  filter_radius0 = gr.Slider(
1603
  minimum=0,
1604
  maximum=7,
1605
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
 
1606
  value=3,
1607
  step=1,
1608
  interactive=True,
@@ -1610,7 +1617,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1610
  resample_sr0 = gr.Slider(
1611
  minimum=0,
1612
  maximum=48000,
1613
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1614
  value=0,
1615
  step=1,
1616
  interactive=True,
@@ -1619,14 +1626,18 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1619
  rms_mix_rate0 = gr.Slider(
1620
  minimum=0,
1621
  maximum=1,
1622
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
 
 
1623
  value=0.21,
1624
  interactive=True,
1625
  )
1626
  protect0 = gr.Slider(
1627
  minimum=0,
1628
  maximum=0.5,
1629
- label=i18n("保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"),
 
 
1630
  value=0.33,
1631
  step=0.01,
1632
  interactive=True,
@@ -1681,7 +1692,10 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1681
  formant_refresh_button.click(fn=update_fshift_presets,inputs=[formant_preset, qfrency, tmbre],outputs=[formant_preset, qfrency, tmbre])
1682
  with gr.Row():
1683
  vc_output1 = gr.Textbox("")
1684
- f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), visible=False)
 
 
 
1685
 
1686
  but0.click(
1687
  vc_single,
@@ -1708,12 +1722,18 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1708
  with gr.Row():
1709
  with gr.Column():
1710
  vc_transform1 = gr.Number(
1711
- label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0
 
 
 
1712
  )
1713
- opt_input = gr.Textbox(label=i18n("指定输出文件夹"), value="opt")
1714
  f0method1 = gr.Radio(
1715
  label=i18n(
1716
- "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU"
 
 
 
1717
  ),
1718
  choices=["pm", "harvest", "crepe", "rmvpe"],
1719
  value="rmvpe",
@@ -1722,19 +1742,22 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1722
  filter_radius1 = gr.Slider(
1723
  minimum=0,
1724
  maximum=7,
1725
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
 
1726
  value=3,
1727
  step=1,
1728
  interactive=True,
1729
  )
1730
  with gr.Column():
1731
  file_index3 = gr.Textbox(
1732
- label=i18n("特征检索库文件路径,为空则使用下拉的选择结果"),
 
 
1733
  value="",
1734
  interactive=True,
1735
  )
1736
  file_index4 = gr.Dropdown(
1737
- label=i18n("自动检测index路径,下拉式选择(dropdown)"),
1738
  choices=sorted(index_paths),
1739
  interactive=True,
1740
  )
@@ -1759,7 +1782,8 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1759
  resample_sr1 = gr.Slider(
1760
  minimum=0,
1761
  maximum=48000,
1762
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
 
1763
  value=0,
1764
  step=1,
1765
  interactive=True,
@@ -1767,7 +1791,8 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1767
  rms_mix_rate1 = gr.Slider(
1768
  minimum=0,
1769
  maximum=1,
1770
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
 
1771
  value=1,
1772
  interactive=True,
1773
  )
@@ -1775,7 +1800,10 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1775
  minimum=0,
1776
  maximum=0.5,
1777
  label=i18n(
1778
- "保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"
 
 
 
1779
  ),
1780
  value=0.33,
1781
  step=0.01,
@@ -1783,11 +1811,15 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1783
  )
1784
  with gr.Column():
1785
  dir_input = gr.Textbox(
1786
- label=i18n("输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)"),
1787
- value="E:\codes\py39\\test-20230416b\\todo-songs",
 
 
1788
  )
1789
  inputs = gr.File(
1790
- file_count="multiple", label=i18n("也可批量输入音频文件, 二选一, 优先读文件夹")
 
 
1791
  )
1792
  with gr.Row():
1793
  format1 = gr.Radio(
@@ -1797,7 +1829,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1797
  interactive=True,
1798
  )
1799
  but1 = gr.Button(i18n("转换"), variant="primary")
1800
- vc_output3 = gr.Textbox(label=i18n("输出信息"))
1801
  but1.click(
1802
  vc_multi,
1803
  [
@@ -1821,7 +1853,7 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1821
  [vc_output3],
1822
  )
1823
  but1.click(fn=lambda: easy_uploader.clear())
1824
- with gr.TabItem("Download Model"):
1825
  with gr.Row():
1826
  url=gr.Textbox(label="Enter the URL to the Model:")
1827
  with gr.Row():
@@ -1829,13 +1861,14 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1829
  download_button=gr.Button("Download")
1830
  with gr.Row():
1831
  status_bar=gr.Textbox(label="")
1832
- download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
 
1833
  with gr.Row():
1834
  gr.Markdown(
1835
  """
1836
  Made with ❤️ by [Alice Oliveira](https://github.com/aliceoq) | Hosted with ❤️ by [Mateus Elias](https://github.com/mateuseap)
1837
  """
1838
- )
1839
 
1840
  def has_two_files_in_pretrained_folder():
1841
  pretrained_folder = "./pretrained/"
@@ -1853,14 +1886,15 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1853
  with gr.Column():
1854
  exp_dir1 = gr.Textbox(label="Voice Name:", value="My-Voice")
1855
  sr2 = gr.Radio(
1856
- label=i18n("目标采样率"),
1857
  choices=["40k", "48k"],
1858
  value="40k",
1859
  interactive=True,
1860
  visible=False
1861
  )
1862
  if_f0_3 = gr.Radio(
1863
- label=i18n("模型是否带音高指导(唱歌一定要, 语音可以不要)"),
 
1864
  choices=[True, False],
1865
  value=True,
1866
  interactive=True,
 
1
  import subprocess, torch, os, traceback, sys, warnings, shutil, numpy as np
2
+ #from mega import Mega
3
  os.environ["no_proxy"] = "localhost, 127.0.0.1, ::1"
4
  import threading
5
  from time import sleep
 
160
 
161
  i18n = I18nAuto()
162
  #i18n.print()
163
+ # Determine if there are N cards that can be used to train and accelerate inference
164
  ngpu = torch.cuda.device_count()
165
  gpu_infos = []
166
  mem = []
 
244
  weight_root = "weights"
245
  index_root = "logs"
246
  names = []
247
+ index_paths = ["./logs/joel/added_IVF479_Flat_nprobe_1.index","./logs/jenny/added_IVF533_Flat_nprobe_1.index"]
248
+ file_index=None
 
 
 
 
 
 
249
 
250
 
251
 
 
271
  f0_up_key = int(f0_up_key)
272
  try:
273
  audio = load_audio(input_audio_path, 16000, DoFormant, Quefrency, Timbre)
274
+ logging.log(logging.INFO, "audio loaded")
275
  audio_max = np.abs(audio).max() / 0.95
276
  if audio_max > 1:
277
  audio /= audio_max
278
  times = [0, 0, 0]
279
+ if hubert_model is None:
280
  load_hubert()
281
  if_f0 = cpt.get("f0", 1)
282
+ print(file_index)
283
  file_index = (
284
  (
285
  file_index.strip(" ")
 
289
  .strip(" ")
290
  .replace("trained", "added")
291
  )
292
+ ) # Determine whether there is an N card that can
293
+ # be used to prevent Xiao Bai from writing incorrectly
294
+ # and automatically replace and speed up his reasoning
295
  # file_big_npy = (
296
  # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
297
  # )
 
357
  try:
358
  dir_path = (
359
  dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
360
+ ) # Uninstall, please select Speaker ID, Timbre, Save Memory, prevent
361
+ # small white copy, path with spaces at the end and "and enter."
362
  opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
363
  os.makedirs(opt_root, exist_ok=True)
364
  try:
 
415
  except:
416
  yield traceback.format_exc()
417
 
418
+ # 一A tab can have only one tone globally
419
+ def get_vc(sid, person):
420
  global n_spk, tgt_sr, net_g, vc, cpt, version
421
  if sid == "" or sid == []:
422
  global hubert_model
423
+ if hubert_model != None: # tabs take into account polling,
424
+ # and you need to add a judgment to see if the SID can
425
+ # only have one tone to switch from model to no model
426
  print("clean_empty_cache")
427
  del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
428
  hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
 
1258
  audio_files=[]
1259
  for filename in os.listdir("./audios"):
1260
  if filename.endswith(('.wav','.mp3','.ogg','.flac','.m4a','.aac','.mp4')):
1261
+ audio_files.append(os.path.join('./audios',filename).replace('\\', '/'))
1262
 
1263
  def get_index():
1264
  if check_for_name() != '':
 
1305
  return os.path.join('./audios',os.path.basename(file_path))
1306
 
1307
  def match_index(sid0):
1308
+ global file_index
1309
+ if sid0 == '':
1310
+ file_index = ''
1311
+ elif sid0 == "joel.pth":
1312
+ file_index = "./logs/joel/added_IVF479_Flat_nprobe_1.index"
1313
+ elif sid0 == "jenny.pth":
1314
+ file_index = "./logs/jenny/added_IVF533_Flat_nprobe_1.index"
1315
+
1316
+ return file_index
1317
 
1318
  def check_for_name():
1319
  if len(names) > 0:
 
1338
  try:
1339
  if "drive.google.com" in url:
1340
  subprocess.run(["gdown", url, "--fuzzy", "-O", zipfile_path])
1341
+ #elif "mega.nz" in url:
1342
+ # m = Mega()
1343
+ # m.download_url(url, './zips')
1344
  else:
1345
  subprocess.run(["wget", url, "-O", zipfile_path])
1346
  for filename in os.listdir("./zips"):
 
1471
  else:
1472
  return f'./weights/{model}.pth', "Could not find Index file."
1473
 
1474
+ with gr.Blocks(theme=gr.themes.Base(), title='RVC RULE1 v1') as app:
1475
+ global person
1476
  with gr.Tabs():
1477
  with gr.TabItem("Inference"):
1478
+ gr.HTML("<h1> RVC_RULE1 -- Humans First </h1>")
1479
+ gr.HTML('<h3>A few notes about this demo: Hit "Refresh" if you do not immediately see the model\
1480
+ choices come up. Once you have chosen either Joel ("joel.pth") or Jenny ("jenny.pth"),\
1481
+ make sure that your index setting to the right matches up with the model. For instance, if Joel is selected\
1482
+ choose the index file that has joel in the file path.</h3>')
1483
+ gr.HTML("<h10> Huggingface version v1 -- DT </h10>")
1484
+ # gr.HTML("<h4> If you want to use this space privately, I recommend you duplicate the space. </h4>")
1485
 
1486
  # Inference Preset Row
1487
  # with gr.Row():
 
1493
 
1494
  # Other RVC stuff
1495
  with gr.Row():
1496
+ sid0 = gr.Dropdown(label="Choose your Model.", choices=sorted(names), value="joel.pth")
1497
  refresh_button = gr.Button("Refresh", variant="primary")
1498
  if check_for_name() != '':
1499
  get_vc(sorted(names)[0])
1500
  vc_transform0 = gr.Number(label="Optional: You can change the pitch here or leave it at 0.", value=0)
1501
+ #clean_button = gr.Button(i18n("Uninstall the sound saving video memory"), variant="primary")
1502
  spk_item = gr.Slider(
1503
  minimum=0,
1504
  maximum=2333,
1505
  step=1,
1506
+ label=i18n("To uninstall please select Speaker ID Timbre to save the video memory"),
1507
  value=0,
1508
  visible=False,
1509
  interactive=True,
 
1532
  refresh_button2 = gr.Button("Refresh", variant="primary", size='sm')
1533
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1534
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1535
+ '''with gr.Row():
1536
  with gr.Accordion('Text To Speech', open=False):
1537
  with gr.Column():
1538
  lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['en','es','fr','pt','zh-CN','de','hi','ja'], value='en')
 
1555
  animation = gr.Video(type='filepath')
1556
  refresh_button2.click(fn=change_choices2, inputs=[], outputs=[input_audio0, animation])
1557
  with gr.Row():
1558
+ animate_button = gr.Button('Animate')'''
1559
 
1560
  with gr.Column():
1561
  with gr.Accordion("Index Settings", open=False):
1562
  file_index1 = gr.Dropdown(
1563
  label="3. Path to your added.index file (if it didn't automatically find it.)",
1564
+ choices=[match_index(sid0)] if file_index else match_index("joel.pth"),
1565
+ value=match_index("joel.pth"),
1566
  interactive=True,
1567
  )
1568
  sid0.change(fn=match_index, inputs=[sid0],outputs=[file_index1])
 
1577
  index_rate1 = gr.Slider(
1578
  minimum=0,
1579
  maximum=1,
1580
+ label=i18n("The proportion of features retrieved"),
1581
  value=0.66,
1582
  interactive=True,
1583
  )
 
1586
  type='filepath',
1587
  interactive=False,
1588
  )
1589
+ #animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1590
  with gr.Accordion("Advanced Settings", open=False):
1591
  f0method0 = gr.Radio(
1592
  label="Optional: Change the Pitch Extraction Algorithm.\nExtraction methods are sorted from 'worst quality' to 'best quality'.\nmangio-crepe may or may not be better than rmvpe in cases where 'smoothness' is more important, but rmvpe is the best overall.",
 
1608
  filter_radius0 = gr.Slider(
1609
  minimum=0,
1610
  maximum=7,
1611
+ label=i18n(">=3 uses median filtering for the results of Harvest pitch recognition,\
1612
+ which is the filter radius, which can weaken the mute"),
1613
  value=3,
1614
  step=1,
1615
  interactive=True,
 
1617
  resample_sr0 = gr.Slider(
1618
  minimum=0,
1619
  maximum=48000,
1620
+ label=i18n("Post-process resampling to the final sample rate, 0 is no resampling at all"),
1621
  value=0,
1622
  step=1,
1623
  interactive=True,
 
1626
  rms_mix_rate0 = gr.Slider(
1627
  minimum=0,
1628
  maximum=1,
1629
+ label=i18n("The input source volume envelope replaces the output\
1630
+ volume envelope fusion ratio, and the closer to 1,\
1631
+ the output envelope is used"),
1632
  value=0.21,
1633
  interactive=True,
1634
  )
1635
  protect0 = gr.Slider(
1636
  minimum=0,
1637
  maximum=0.5,
1638
+ label=i18n("Protect clean consonants and breathing sounds, prevent artifacts\
1639
+ such as electrical tearing, pull 0.5 full and do not turn on,\
1640
+ turn down to increase protection but may reduce the index effect"),
1641
  value=0.33,
1642
  step=0.01,
1643
  interactive=True,
 
1692
  formant_refresh_button.click(fn=update_fshift_presets,inputs=[formant_preset, qfrency, tmbre],outputs=[formant_preset, qfrency, tmbre])
1693
  with gr.Row():
1694
  vc_output1 = gr.Textbox("")
1695
+ f0_file = gr.File(label=i18n("Retrieve feature occupancy F0 curve files, optionally,\
1696
+ one pitch per line, instead of the default F0 and the upward\
1697
+ and downward adjustment stop of the small white copy path with\
1698
+ spaces at the beginning and end and carriage return ratio."), visible=False)
1699
 
1700
  but0.click(
1701
  vc_single,
 
1722
  with gr.Row():
1723
  with gr.Column():
1724
  vc_transform1 = gr.Number(
1725
+ label=i18n("Pitch inflection\
1726
+ (integer, number of chromats,\
1727
+ ascending octave 12 descending\
1728
+ octave-12)"), value=0
1729
  )
1730
+ opt_input = gr.Textbox(label=i18n("Specify the output folder"), value="opt")
1731
  f0method1 = gr.Radio(
1732
  label=i18n(
1733
+ "Select the pitch extraction algorithm,\
1734
+ the input singing voice can be accelerated by pm, the harvest\
1735
+ bass is good but extremely slow, and the crepe effect is good\
1736
+ but eats the GPU"
1737
  ),
1738
  choices=["pm", "harvest", "crepe", "rmvpe"],
1739
  value="rmvpe",
 
1742
  filter_radius1 = gr.Slider(
1743
  minimum=0,
1744
  maximum=7,
1745
+ label=i18n(">=3 uses median filtering for the results of Harvest\
1746
+ pitch recognition, which is the filter radius, which can weaken the mute"),
1747
  value=3,
1748
  step=1,
1749
  interactive=True,
1750
  )
1751
  with gr.Column():
1752
  file_index3 = gr.Textbox(
1753
+ label=i18n("Feature retrieval library file\
1754
+ path, empty to use drop-down\
1755
+ selection results"),
1756
  value="",
1757
  interactive=True,
1758
  )
1759
  file_index4 = gr.Dropdown(
1760
+ label=i18n("Automatic detection of index path, dropdown selection"),
1761
  choices=sorted(index_paths),
1762
  interactive=True,
1763
  )
 
1782
  resample_sr1 = gr.Slider(
1783
  minimum=0,
1784
  maximum=48000,
1785
+ label=i18n("Post-process\
1786
+ resampling to the final sample rate, 0 is no resampling at all"),
1787
  value=0,
1788
  step=1,
1789
  interactive=True,
 
1791
  rms_mix_rate1 = gr.Slider(
1792
  minimum=0,
1793
  maximum=1,
1794
+ label=i18n("The input source volume envelope replaces the output volume\
1795
+ envelope fusion ratio, and the closer to 1, the output envelope is used"),
1796
  value=1,
1797
  interactive=True,
1798
  )
 
1800
  minimum=0,
1801
  maximum=0.5,
1802
  label=i18n(
1803
+ "Protect clean consonants and breathing sounds, prevent\
1804
+ artifacts such as electrical tearing, pull 0.5 full\
1805
+ and do not turn on, turn down to increase protection\
1806
+ but may reduce the index effect"
1807
  ),
1808
  value=0.33,
1809
  step=0.01,
 
1811
  )
1812
  with gr.Column():
1813
  dir_input = gr.Textbox(
1814
+ label=i18n("Enter the path to the folder of the audio to be\
1815
+ processed (just go to the file manager address bar\
1816
+ and copy it.))"),
1817
+ value="E:\\codes\\py39\\vits_vc_gpu_train\\audio",
1818
  )
1819
  inputs = gr.File(
1820
+ file_count="multiple", label=i18n("You can also batch input\
1821
+ audio files, choose one of the two, and read the\
1822
+ folder first")
1823
  )
1824
  with gr.Row():
1825
  format1 = gr.Radio(
 
1829
  interactive=True,
1830
  )
1831
  but1 = gr.Button(i18n("转换"), variant="primary")
1832
+ vc_output3 = gr.Textbox(label=i18n("Output information"))
1833
  but1.click(
1834
  vc_multi,
1835
  [
 
1853
  [vc_output3],
1854
  )
1855
  but1.click(fn=lambda: easy_uploader.clear())
1856
+ '''with gr.TabItem("Download Model"):
1857
  with gr.Row():
1858
  url=gr.Textbox(label="Enter the URL to the Model:")
1859
  with gr.Row():
 
1861
  download_button=gr.Button("Download")
1862
  with gr.Row():
1863
  status_bar=gr.Textbox(label="")
1864
+ download_button.click(fn=download_from_url,\
1865
+ inputs=[url, model], outputs=[status_bar])
1866
  with gr.Row():
1867
  gr.Markdown(
1868
  """
1869
  Made with ❤️ by [Alice Oliveira](https://github.com/aliceoq) | Hosted with ❤️ by [Mateus Elias](https://github.com/mateuseap)
1870
  """
1871
+ )'''
1872
 
1873
  def has_two_files_in_pretrained_folder():
1874
  pretrained_folder = "./pretrained/"
 
1886
  with gr.Column():
1887
  exp_dir1 = gr.Textbox(label="Voice Name:", value="My-Voice")
1888
  sr2 = gr.Radio(
1889
+ label=i18n("Target sample rate"),
1890
  choices=["40k", "48k"],
1891
  value="40k",
1892
  interactive=True,
1893
  visible=False
1894
  )
1895
  if_f0_3 = gr.Radio(
1896
+ label=i18n("Whether the model has pitch guidance\
1897
+ (singing must be, voice can not)"),
1898
  choices=[True, False],
1899
  value=True,
1900
  interactive=True,
gitignore.txt CHANGED
@@ -4,8 +4,14 @@ TEMP/
4
  logs/
5
  csvdb/
6
 
7
- # Environment
 
 
 
8
  venv/
 
 
 
9
 
10
  # Models
11
  hubert_base.pt
 
4
  logs/
5
  csvdb/
6
 
7
+ # Environments
8
+ .env
9
+ .venv
10
+ env/
11
  venv/
12
+ ENV/
13
+ env.bak/
14
+ venv.bak/
15
 
16
  # Models
17
  hubert_base.pt
utils.py CHANGED
@@ -56,7 +56,8 @@ def load_audio(file, sr, DoFormant, Quefrency, Timbre):
56
  # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
57
  file = (
58
  file.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
59
- ) # 防止小白拷路径头尾带了空格和"和回车
 
60
  file_formanted = file.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
61
 
62
  # print(f"dofor={bool(DoFormant)} timbr={Timbre} quef={Quefrency}\n")
 
56
  # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
57
  file = (
58
  file.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
59
+ ) # The search feature accounts for the "and" and carriage return
60
+ # ratios that prevent small white copy paths with spaces at the end and ends
61
  file_formanted = file.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
62
 
63
  # print(f"dofor={bool(DoFormant)} timbr={Timbre} quef={Quefrency}\n")