Politrees commited on
Commit
c2b7a0c
1 Parent(s): e15804a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -487
app.py CHANGED
@@ -450,7 +450,7 @@ def get_vc(sid):
450
  cpt = None
451
  return {"visible": False, "__type__": "update"}
452
  person = "%s/%s" % (weight_root, sid)
453
- print("loading %s" % person)
454
  cpt = torch.load(person, map_location="cpu")
455
  tgt_sr = cpt["config"][-1]
456
  cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
@@ -1472,10 +1472,10 @@ def zip_downloader(model):
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,11 +1487,11 @@ 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,
@@ -1508,53 +1508,39 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1508
  inputs=[sid0],
1509
  outputs=[spk_item],
1510
  )
1511
- but0 = gr.Button("Convert", variant="primary")
1512
  with gr.Row():
1513
  with gr.Column():
1514
  with gr.Row():
1515
- dropbox = gr.File(label="Drop your audio here & hit the Reload button.")
1516
  with gr.Row():
1517
- record_button=gr.Audio(source="microphone", label="OR Record audio.", type="filepath")
1518
  with gr.Row():
1519
  input_audio0 = gr.Dropdown(
1520
- label="2.Choose your audio.",
1521
  value="./audios/someguy.mp3",
1522
  choices=audio_files
1523
  )
1524
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1525
  dropbox.upload(fn=change_choices2, inputs=[], outputs=[input_audio0])
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')
1533
- api_box = gr.Textbox(label="Enter your API Key for ElevenLabs, or leave empty to use GoogleTTS", value='')
1534
- elevenid=gr.Dropdown(label="Voice:", choices=eleven_voices)
1535
  with gr.Column():
1536
- tfs = gr.Textbox(label="Input your Text", interactive=True, value="This is a test.")
1537
- tts_button = gr.Button(value="Speak")
1538
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
1539
- with gr.Row():
1540
- with gr.Accordion('Wav2Lip', open=False):
1541
- with gr.Row():
1542
- size = gr.Radio(label='Resolution:',choices=['Half','Full'])
1543
- face = gr.UploadButton("Upload A Character",type='file')
1544
- faces = gr.Dropdown(label="OR Choose one:", choices=['None','Ben Shapiro','Andrew Tate'])
1545
- with gr.Row():
1546
- preview = gr.Textbox(label="Status:",interactive=False)
1547
- face.upload(fn=success_message,inputs=[face], outputs=[preview, faces])
1548
- with gr.Row():
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,
@@ -1571,19 +1557,19 @@ 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
  )
1578
  vc_output2 = gr.Audio(
1579
- label="Output Audio (Click on the Three Dots in the Right Corner to Download)",
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.",
1587
  choices=["pm", "dio", "crepe-tiny", "mangio-crepe-tiny", "crepe", "harvest", "mangio-crepe", "rmvpe"], # Fork Feature. Add Crepe-Tiny
1588
  value="rmvpe",
1589
  interactive=True,
@@ -1593,16 +1579,15 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1593
  minimum=1,
1594
  maximum=512,
1595
  step=1,
1596
- label="Mangio-Crepe Hop Length. Higher numbers will reduce the chance of extreme pitch changes but lower numbers will increase accuracy. 64-192 is a good range to experiment with.",
1597
  value=120,
1598
- interactive=True,
1599
- visible=False,
1600
  )
1601
  f0method0.change(fn=whethercrepeornah, inputs=[f0method0], outputs=[crepe_hop_length])
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,
@@ -1619,470 +1604,31 @@ 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,
1633
  )
1634
- formanting = gr.Checkbox(
1635
- value=bool(DoFormant),
1636
- label="[EXPERIMENTAL] Formant shift inference audio",
1637
- info="Used for male to female and vice-versa conversions",
1638
- interactive=True,
1639
- visible=True,
1640
- )
1641
-
1642
- formant_preset = gr.Dropdown(
1643
- value='',
1644
- choices=get_fshift_presets(),
1645
- label="browse presets for formanting",
1646
- visible=bool(DoFormant),
1647
- )
1648
- formant_refresh_button = gr.Button(
1649
- value='\U0001f504',
1650
- visible=bool(DoFormant),
1651
- variant='primary',
1652
- )
1653
- #formant_refresh_button = ToolButton( elem_id='1')
1654
- #create_refresh_button(formant_preset, lambda: {"choices": formant_preset}, "refresh_list_shiftpresets")
1655
-
1656
- qfrency = gr.Slider(
1657
- value=Quefrency,
1658
- info="Default value is 1.0",
1659
- label="Quefrency for formant shifting",
1660
- minimum=0.0,
1661
- maximum=16.0,
1662
- step=0.1,
1663
- visible=bool(DoFormant),
1664
- interactive=True,
1665
- )
1666
- tmbre = gr.Slider(
1667
- value=Timbre,
1668
- info="Default value is 1.0",
1669
- label="Timbre for formant shifting",
1670
- minimum=0.0,
1671
- maximum=16.0,
1672
- step=0.1,
1673
- visible=bool(DoFormant),
1674
- interactive=True,
1675
  )
1676
 
1677
- formant_preset.change(fn=preset_apply, inputs=[formant_preset, qfrency, tmbre], outputs=[qfrency, tmbre])
1678
- frmntbut = gr.Button("Apply", variant="primary", visible=bool(DoFormant))
1679
- formanting.change(fn=formant_enabled,inputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button],outputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button])
1680
- frmntbut.click(fn=formant_apply,inputs=[qfrency, tmbre], outputs=[qfrency, tmbre])
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,
1688
- [
1689
- spk_item,
1690
- input_audio0,
1691
- vc_transform0,
1692
- f0_file,
1693
- f0method0,
1694
- file_index1,
1695
- # file_index2,
1696
- # file_big_npy1,
1697
- index_rate1,
1698
- filter_radius0,
1699
- resample_sr0,
1700
- rms_mix_rate0,
1701
- protect0,
1702
- crepe_hop_length
1703
- ],
1704
- [vc_output1, vc_output2],
1705
- )
1706
-
1707
- with gr.Accordion("Batch Conversion",open=False):
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",
1720
- interactive=True,
1721
- )
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
- )
1741
- refresh_button.click(
1742
- fn=lambda: change_choices()[1],
1743
- inputs=[],
1744
- outputs=file_index4,
1745
- )
1746
- # file_big_npy2 = gr.Textbox(
1747
- # label=i18n("特征文件路径"),
1748
- # value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
1749
- # interactive=True,
1750
- # )
1751
- index_rate2 = gr.Slider(
1752
- minimum=0,
1753
- maximum=1,
1754
- label=i18n("检索特征占比"),
1755
- value=1,
1756
- interactive=True,
1757
- )
1758
- with gr.Column():
1759
- resample_sr1 = gr.Slider(
1760
- minimum=0,
1761
- maximum=48000,
1762
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1763
- value=0,
1764
- step=1,
1765
- interactive=True,
1766
- )
1767
- rms_mix_rate1 = gr.Slider(
1768
- minimum=0,
1769
- maximum=1,
1770
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1771
- value=1,
1772
- interactive=True,
1773
- )
1774
- protect1 = gr.Slider(
1775
- minimum=0,
1776
- maximum=0.5,
1777
- label=i18n(
1778
- "保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"
1779
- ),
1780
- value=0.33,
1781
- step=0.01,
1782
- interactive=True,
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(
1794
- label=i18n("导出文件格式"),
1795
- choices=["wav", "flac", "mp3", "m4a"],
1796
- value="flac",
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
- [
1804
- spk_item,
1805
- dir_input,
1806
- opt_input,
1807
- inputs,
1808
- vc_transform1,
1809
- f0method1,
1810
- file_index3,
1811
- file_index4,
1812
- # file_big_npy2,
1813
- index_rate2,
1814
- filter_radius1,
1815
- resample_sr1,
1816
- rms_mix_rate1,
1817
- protect1,
1818
- format1,
1819
- crepe_hop_length,
1820
- ],
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():
1828
- model = gr.Textbox(label="Name your model:")
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/"
1842
- if not os.path.exists(pretrained_folder):
1843
- return False
1844
-
1845
- files_in_folder = os.listdir(pretrained_folder)
1846
- num_files = len(files_in_folder)
1847
- return num_files >= 2
1848
-
1849
- if has_two_files_in_pretrained_folder():
1850
- print("Pretrained weights are downloaded. Training tab enabled!\n-------------------------------")
1851
- with gr.TabItem("Train", visible=False):
1852
- with gr.Row():
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,
1867
- visible=False
1868
- )
1869
- version19 = gr.Radio(
1870
- label="RVC version",
1871
- choices=["v1", "v2"],
1872
- value="v2",
1873
- interactive=True,
1874
- visible=False,
1875
- )
1876
- np7 = gr.Slider(
1877
- minimum=0,
1878
- maximum=config.n_cpu,
1879
- step=1,
1880
- label="# of CPUs for data processing (Leave as it is)",
1881
- value=config.n_cpu,
1882
- interactive=True,
1883
- visible=True
1884
- )
1885
- trainset_dir4 = gr.Textbox(label="Path to your dataset (audios, not zip):", value="./dataset")
1886
- easy_uploader = gr.Files(label='OR Drop your audios here. They will be uploaded in your dataset path above.',file_types=['audio'])
1887
- but1 = gr.Button("1. Process The Dataset", variant="primary")
1888
- info1 = gr.Textbox(label="Status (wait until it says 'end preprocess'):", value="")
1889
- easy_uploader.upload(fn=upload_to_dataset, inputs=[easy_uploader, trainset_dir4], outputs=[info1])
1890
- but1.click(
1891
- preprocess_dataset, [trainset_dir4, exp_dir1, sr2, np7], [info1]
1892
- )
1893
- with gr.Column():
1894
- spk_id5 = gr.Slider(
1895
- minimum=0,
1896
- maximum=4,
1897
- step=1,
1898
- label=i18n("请指定说话人id"),
1899
- value=0,
1900
- interactive=True,
1901
- visible=False
1902
- )
1903
- with gr.Accordion('GPU Settings', open=False, visible=False):
1904
- gpus6 = gr.Textbox(
1905
- label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"),
1906
- value=gpus,
1907
- interactive=True,
1908
- visible=False
1909
- )
1910
- gpu_info9 = gr.Textbox(label=i18n("显卡信息"), value=gpu_info)
1911
- f0method8 = gr.Radio(
1912
- label=i18n(
1913
- "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢"
1914
- ),
1915
- choices=["harvest","crepe", "mangio-crepe", "rmvpe"], # Fork feature: Crepe on f0 extraction for training.
1916
- value="rmvpe",
1917
- interactive=True,
1918
- )
1919
-
1920
- extraction_crepe_hop_length = gr.Slider(
1921
- minimum=1,
1922
- maximum=512,
1923
- step=1,
1924
- label=i18n("crepe_hop_length"),
1925
- value=128,
1926
- interactive=True,
1927
- visible=False,
1928
- )
1929
- f0method8.change(fn=whethercrepeornah, inputs=[f0method8], outputs=[extraction_crepe_hop_length])
1930
- but2 = gr.Button("2. Pitch Extraction", variant="primary")
1931
- info2 = gr.Textbox(label="Status(Check the Colab Notebook's cell output):", value="", max_lines=8)
1932
- but2.click(
1933
- extract_f0_feature,
1934
- [gpus6, np7, f0method8, if_f0_3, exp_dir1, version19, extraction_crepe_hop_length],
1935
- [info2],
1936
- )
1937
- with gr.Row():
1938
- with gr.Column():
1939
- total_epoch11 = gr.Slider(
1940
- minimum=1,
1941
- maximum=5000,
1942
- step=10,
1943
- label="Total # of training epochs (IF you choose a value too high, your model will sound horribly overtrained.):",
1944
- value=250,
1945
- interactive=True,
1946
- )
1947
- butstop = gr.Button(
1948
- "Stop Training",
1949
- variant='primary',
1950
- visible=False,
1951
- )
1952
- but3 = gr.Button("3. Train Model", variant="primary", visible=True)
1953
-
1954
- but3.click(fn=stoptraining, inputs=[gr.Number(value=0, visible=False)], outputs=[but3, butstop])
1955
- butstop.click(fn=stoptraining, inputs=[gr.Number(value=1, visible=False)], outputs=[butstop, but3])
1956
-
1957
-
1958
- but4 = gr.Button("4.Train Index", variant="primary")
1959
- info3 = gr.Textbox(label="Status(Check the Colab Notebook's cell output):", value="", max_lines=10)
1960
- with gr.Accordion("Training Preferences (You can leave these as they are)", open=False):
1961
- #gr.Markdown(value=i18n("step3: 填写训练设置, 开始训练模型和索引"))
1962
- with gr.Column():
1963
- save_epoch10 = gr.Slider(
1964
- minimum=1,
1965
- maximum=200,
1966
- step=1,
1967
- label="Backup every X amount of epochs:",
1968
- value=10,
1969
- interactive=True,
1970
- )
1971
- batch_size12 = gr.Slider(
1972
- minimum=1,
1973
- maximum=40,
1974
- step=1,
1975
- label="Batch Size (LEAVE IT unless you know what you're doing!):",
1976
- value=default_batch_size,
1977
- interactive=True,
1978
- )
1979
- if_save_latest13 = gr.Checkbox(
1980
- label="Save only the latest '.ckpt' file to save disk space.",
1981
- value=True,
1982
- interactive=True,
1983
- )
1984
- if_cache_gpu17 = gr.Checkbox(
1985
- label="Cache all training sets to GPU memory. Caching small datasets (less than 10 minutes) can speed up training, but caching large datasets will consume a lot of GPU memory and may not provide much speed improvement.",
1986
- value=False,
1987
- interactive=True,
1988
- )
1989
- if_save_every_weights18 = gr.Checkbox(
1990
- label="Save a small final model to the 'weights' folder at each save point.",
1991
- value=True,
1992
- interactive=True,
1993
- )
1994
- zip_model = gr.Button('5. Download Model')
1995
- zipped_model = gr.Files(label='Your Model and Index file can be downloaded here:')
1996
- zip_model.click(fn=zip_downloader, inputs=[exp_dir1], outputs=[zipped_model, info3])
1997
- with gr.Group():
1998
- with gr.Accordion("Base Model Locations:", open=False, visible=False):
1999
- pretrained_G14 = gr.Textbox(
2000
- label=i18n("加载预训练底模G路径"),
2001
- value="pretrained_v2/f0G40k.pth",
2002
- interactive=True,
2003
- )
2004
- pretrained_D15 = gr.Textbox(
2005
- label=i18n("加载预训练底模D路径"),
2006
- value="pretrained_v2/f0D40k.pth",
2007
- interactive=True,
2008
- )
2009
- gpus16 = gr.Textbox(
2010
- label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"),
2011
- value=gpus,
2012
- interactive=True,
2013
- )
2014
- sr2.change(
2015
- change_sr2,
2016
- [sr2, if_f0_3, version19],
2017
- [pretrained_G14, pretrained_D15, version19],
2018
- )
2019
- version19.change(
2020
- change_version19,
2021
- [sr2, if_f0_3, version19],
2022
- [pretrained_G14, pretrained_D15],
2023
- )
2024
- if_f0_3.change(
2025
- change_f0,
2026
- [if_f0_3, sr2, version19],
2027
- [f0method8, pretrained_G14, pretrained_D15],
2028
- )
2029
- but5 = gr.Button(i18n("一键训练"), variant="primary", visible=False)
2030
- but3.click(
2031
- click_train,
2032
- [
2033
- exp_dir1,
2034
- sr2,
2035
- if_f0_3,
2036
- spk_id5,
2037
- save_epoch10,
2038
- total_epoch11,
2039
- batch_size12,
2040
- if_save_latest13,
2041
- pretrained_G14,
2042
- pretrained_D15,
2043
- gpus16,
2044
- if_cache_gpu17,
2045
- if_save_every_weights18,
2046
- version19,
2047
- ],
2048
- [
2049
- info3,
2050
- butstop,
2051
- but3,
2052
- ],
2053
- )
2054
- but4.click(train_index, [exp_dir1, version19], info3)
2055
- but5.click(
2056
- train1key,
2057
- [
2058
- exp_dir1,
2059
- sr2,
2060
- if_f0_3,
2061
- trainset_dir4,
2062
- spk_id5,
2063
- np7,
2064
- f0method8,
2065
- save_epoch10,
2066
- total_epoch11,
2067
- batch_size12,
2068
- if_save_latest13,
2069
- pretrained_G14,
2070
- pretrained_D15,
2071
- gpus16,
2072
- if_cache_gpu17,
2073
- if_save_every_weights18,
2074
- version19,
2075
- extraction_crepe_hop_length
2076
- ],
2077
- info3,
2078
- )
2079
-
2080
- else:
2081
- print(
2082
- "Pretrained weights not downloaded. Disabling training tab.\n"
2083
- "Wondering how to train a voice? Visit here for the RVC model training guide: https://t.ly/RVC_Training_Guide\n"
2084
- "-------------------------------\n"
2085
- )
2086
 
2087
  app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=True)
2088
  #endregion
 
450
  cpt = None
451
  return {"visible": False, "__type__": "update"}
452
  person = "%s/%s" % (weight_root, sid)
453
+ print("Загрузка %s" % person)
454
  cpt = torch.load(person, map_location="cpu")
455
  tgt_sr = cpt["config"][-1]
456
  cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
 
1472
 
1473
  with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
1474
  with gr.Tabs():
1475
+ with gr.TabItem("Интерфейс"):
1476
  gr.HTML("<h1> RVC V2 Huggingface Version </h1>")
1477
+ gr.HTML("<h10> Huggingface version выполненная Clebersla (https://huggingface.co/spaces/Clebersla/RVC_V2_Huggingface_Version) </h10>")
1478
+ gr.HTML("<h4> Если вы хотите использовать это помещение в частном порядке, я рекомендую продублировать его. </h4>")
1479
 
1480
  # Inference Preset Row
1481
  # with gr.Row():
 
1487
 
1488
  # Other RVC stuff
1489
  with gr.Row():
1490
+ sid0 = gr.Dropdown(label="1.Выберите свою модель.", choices=sorted(names), value=check_for_name())
1491
+ refresh_button = gr.Button("Обновить", variant="primary")
1492
  if check_for_name() != '':
1493
  get_vc(sorted(names)[0])
1494
+ vc_transform0 = gr.Number(label="Дополнительно: Здесь можно изменить высоту тона или оставить ее равной 0.", value=0)
1495
  #clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
1496
  spk_item = gr.Slider(
1497
  minimum=0,
 
1508
  inputs=[sid0],
1509
  outputs=[spk_item],
1510
  )
1511
+ but0 = gr.Button("Конвертировать", variant="primary")
1512
  with gr.Row():
1513
  with gr.Column():
1514
  with gr.Row():
1515
+ dropbox = gr.File(label='Отправьте аудиозапись сюда и нажмите кнопку "Перезагрузка".')
1516
  with gr.Row():
1517
+ record_button=gr.Audio(source="microphone", label="Запись звука с микрофона.", type="filepath")
1518
  with gr.Row():
1519
  input_audio0 = gr.Dropdown(
1520
+ label="2.Выберите аудиозапись.",
1521
  value="./audios/someguy.mp3",
1522
  choices=audio_files
1523
  )
1524
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1525
  dropbox.upload(fn=change_choices2, inputs=[], outputs=[input_audio0])
1526
+ refresh_button2 = gr.Button("Обновить", 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('Текст в речь', open=False):
1531
  with gr.Column():
1532
+ lang = gr.Radio(label='Китайский и японский языки в настоящее время не работают с ElevenLabs.',choices=['en','es','fr','pt','zh-CN','de','hi','ja','ua'], value='en')
1533
+ api_box = gr.Textbox(label="Введите свой API-ключ для ElevenLabs или оставьте пустым, чтобы использовать GoogleTTS", value='')
1534
+ elevenid=gr.Dropdown(label="Голос:", choices=eleven_voices)
1535
  with gr.Column():
1536
+ tfs = gr.Textbox(label="Введите свой текст", interactive=True, value="This is a test.")
1537
+ tts_button = gr.Button(value="Генерировать")
1538
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1539
 
1540
  with gr.Column():
1541
+ with gr.Accordion("Настройки индекса", open=False):
1542
  file_index1 = gr.Dropdown(
1543
+ label="3. Путь к файлу added.index (если он не был найден автоматически).",
1544
  choices=get_indexes(),
1545
  value=get_index(),
1546
  interactive=True,
 
1557
  index_rate1 = gr.Slider(
1558
  minimum=0,
1559
  maximum=1,
1560
+ label=i18n("Процентное соотношение поисковых функций (советую ставить на 0)"),
1561
  value=0.66,
1562
  interactive=True,
1563
  )
1564
  vc_output2 = gr.Audio(
1565
+ label="Выходные аудиоданные (нажмите на три точки в правом углу, чтобы загрузить)",
1566
  type='filepath',
1567
  interactive=False,
1568
  )
1569
  animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1570
+ with gr.Accordion("Дополнительные настройки", open=False):
1571
  f0method0 = gr.Radio(
1572
+ label="Необязательно: Изменить алгоритм извлечения высоты тона.\Методы извлечения отсортированы от "худшего качества" к "лучшему качеству".\mangio-crepe может быть лучше rmvpe или нет в случаях, когда "гладкость" более важна, но в целом rmvpe является лучшим.",
1573
  choices=["pm", "dio", "crepe-tiny", "mangio-crepe-tiny", "crepe", "harvest", "mangio-crepe", "rmvpe"], # Fork Feature. Add Crepe-Tiny
1574
  value="rmvpe",
1575
  interactive=True,
 
1579
  minimum=1,
1580
  maximum=512,
1581
  step=1,
1582
+ label="Mangio-Crepe Hop Length. Более высокие числа уменьшат вероятность экстремального изменения высоты тона, но более низкие числа увеличат точность. 64-192 - хороший диапазон для экспериментов.",
1583
  value=120,
1584
+ interactive=True,,
 
1585
  )
1586
  f0method0.change(fn=whethercrepeornah, inputs=[f0method0], outputs=[crepe_hop_length])
1587
  filter_radius0 = gr.Slider(
1588
  minimum=0,
1589
  maximum=7,
1590
+ label=i18n("Если >=3: применить медианную фильтрацию к собранным результатам питча. Значение представляет собой радиус фильтрации и может уменьшить дыхание."),
1591
  value=3,
1592
  step=1,
1593
  interactive=True,
 
1604
  rms_mix_rate0 = gr.Slider(
1605
  minimum=0,
1606
  maximum=1,
1607
+ label=i18n("Используйте огибающую громкости входа для замены или смешивания с огибающей громкости выхода. Чем ближе это соотношение к 1, тем больше используется огибающая выходного сигнала:"),
1608
  value=0.21,
1609
  interactive=True,
1610
  )
1611
  protect0 = gr.Slider(
1612
  minimum=0,
1613
  maximum=0.5,
1614
+ label=i18n("Защита безголосых согласных и звуков дыхания для предотвращения артефактов, таких как разрывы в электронной музыке. Для отключения установите значение 0,5. Уменьшите значение для усиления защиты, но это может снизить точность индексирования:"),
1615
  value=0.33,
1616
  step=0.01,
1617
  interactive=True,
1618
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1619
  )
1620
 
1621
+ with gr.TabItem("Загрузить модель"):
 
 
 
 
1622
  with gr.Row():
1623
+ url=gr.Textbox(label="Введите URL-адрес модели:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1624
  with gr.Row():
1625
+ model = gr.Textbox(label="Назовите свою модель:")
1626
+ download_button=gr.Button("Загрузить")
1627
  with gr.Row():
1628
  status_bar=gr.Textbox(label="")
1629
  download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
1630
  with gr.Row():
 
 
 
 
1631
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1632
 
1633
  app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=True)
1634
  #endregion