Update app.py
Browse files
app.py
CHANGED
@@ -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("
|
1476 |
gr.HTML("<h1> RVC V2 Huggingface Version </h1>")
|
1477 |
-
gr.HTML("<h10> Huggingface version
|
1478 |
-
gr.HTML("<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
|
1491 |
-
refresh_button = gr.Button("
|
1492 |
if check_for_name() != '':
|
1493 |
get_vc(sorted(names)[0])
|
1494 |
-
vc_transform0 = gr.Number(label="
|
1495 |
#clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
|
1496 |
spk_item = gr.Slider(
|
1497 |
minimum=0,
|
@@ -1508,39 +1508,53 @@ 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("
|
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="
|
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("
|
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('
|
1531 |
with gr.Column():
|
1532 |
-
lang = gr.Radio(label='
|
1533 |
-
api_box = gr.Textbox(label="
|
1534 |
-
elevenid=gr.Dropdown(label="
|
1535 |
with gr.Column():
|
1536 |
-
tfs = gr.Textbox(label="
|
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("
|
1542 |
file_index1 = gr.Dropdown(
|
1543 |
-
label="3.
|
1544 |
choices=get_indexes(),
|
1545 |
value=get_index(),
|
1546 |
interactive=True,
|
@@ -1557,19 +1571,19 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
|
|
1557 |
index_rate1 = gr.Slider(
|
1558 |
minimum=0,
|
1559 |
maximum=1,
|
1560 |
-
label=i18n("
|
1561 |
value=0.66,
|
1562 |
interactive=True,
|
1563 |
)
|
1564 |
vc_output2 = gr.Audio(
|
1565 |
-
label="
|
1566 |
type='filepath',
|
1567 |
interactive=False,
|
1568 |
)
|
1569 |
-
|
1570 |
-
with gr.Accordion("
|
1571 |
f0method0 = gr.Radio(
|
1572 |
-
label=
|
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,16 +1593,16 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
|
|
1579 |
minimum=1,
|
1580 |
maximum=512,
|
1581 |
step=1,
|
1582 |
-
label="Mangio-Crepe Hop Length.
|
1583 |
value=120,
|
1584 |
interactive=True,
|
1585 |
-
visible=False
|
1586 |
)
|
1587 |
f0method0.change(fn=whethercrepeornah, inputs=[f0method0], outputs=[crepe_hop_length])
|
1588 |
filter_radius0 = gr.Slider(
|
1589 |
minimum=0,
|
1590 |
maximum=7,
|
1591 |
-
label=i18n("
|
1592 |
value=3,
|
1593 |
step=1,
|
1594 |
interactive=True,
|
@@ -1605,19 +1619,90 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
|
|
1605 |
rms_mix_rate0 = gr.Slider(
|
1606 |
minimum=0,
|
1607 |
maximum=1,
|
1608 |
-
label=i18n("
|
1609 |
value=0.21,
|
1610 |
interactive=True,
|
1611 |
)
|
1612 |
protect0 = gr.Slider(
|
1613 |
minimum=0,
|
1614 |
maximum=0.5,
|
1615 |
-
label=i18n("
|
1616 |
value=0.33,
|
1617 |
step=0.01,
|
1618 |
interactive=True,
|
1619 |
)
|
1620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1621 |
|
1622 |
with gr.Accordion("Batch Conversion",open=False):
|
1623 |
with gr.Row():
|
@@ -1736,15 +1821,21 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
|
|
1736 |
[vc_output3],
|
1737 |
)
|
1738 |
but1.click(fn=lambda: easy_uploader.clear())
|
1739 |
-
with gr.TabItem("
|
1740 |
with gr.Row():
|
1741 |
-
url=gr.Textbox(label="
|
1742 |
with gr.Row():
|
1743 |
-
model = gr.Textbox(label="
|
1744 |
-
download_button=gr.Button("
|
1745 |
with gr.Row():
|
1746 |
status_bar=gr.Textbox(label="")
|
1747 |
download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
|
|
|
|
|
|
|
|
|
|
|
|
|
1748 |
|
1749 |
def has_two_files_in_pretrained_folder():
|
1750 |
pretrained_folder = "./pretrained/"
|
|
|
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 |
|
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 |
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 |
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 |
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 |
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():
|
|
|
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/"
|