RafaG commited on
Commit
875e79b
1 Parent(s): c563dcc

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -37
app.py CHANGED
@@ -1327,9 +1327,9 @@ def check_for_name():
1327
 
1328
  def download_from_url(url, model):
1329
  if url == '':
1330
- return "URL cannot be left empty."
1331
  if model =='':
1332
- return "You need to name your model. For example: My-Model"
1333
  url = url.strip()
1334
  zip_dirs = ["zips", "unzips"]
1335
  for directory in zip_dirs:
@@ -1363,11 +1363,11 @@ def download_from_url(url, model):
1363
  shutil.copy(file_path,f'./weights/{model}.pth')
1364
  shutil.rmtree("zips")
1365
  shutil.rmtree("unzips")
1366
- return "Model downloaded, you can go back to the inference page!"
1367
  except:
1368
- return "ERROR - The download failed. Check if the link is valid."
1369
  def success_message(face):
1370
- return f'{face.name} has been uploaded.', 'None'
1371
  def mouth(size, face, voice, faces):
1372
  if size == 'Half':
1373
  size = 2
@@ -1481,12 +1481,12 @@ def zip_downloader(model):
1481
  else:
1482
  return f'./weights/{model}.pth', "Could not find Index file."
1483
 
1484
- with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"), title="RVC - AI HUB BRASIL 🇧🇷") as app:
1485
  with gr.Tabs():
1486
  with gr.TabItem("Inference"):
1487
- gr.HTML("<h1> RVC - AI HUB BRASIL 🇧🇷 </h1>")
1488
  gr.HTML("<h10> Você pode encontrar mais modelos em AI Hub: https://discord.gg/aihub <br> ou AI Hub Brasil https://discord.gg/aihubrasil </h10>")
1489
- gr.HTML("<h4> Huggingface port POR Ilaria a partir do Rejekt Easy GUI </h4>")
1490
 
1491
  # Inference Preset Row
1492
  # with gr.Row():
@@ -1498,11 +1498,11 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1498
 
1499
  # Other RVC stuff
1500
  with gr.Row():
1501
- sid0 = gr.Dropdown(label="1.Choose the model.", choices=sorted(names), value=check_for_name())
1502
- refresh_button = gr.Button("Refresh", variant="primary")
1503
  if check_for_name() != '':
1504
  get_vc(sorted(names)[0])
1505
- vc_transform0 = gr.Number(label="Pitch: 0 from man to man (or woman to woman); 12 from man to woman and -12 from woman to man.", value=0)
1506
  #clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
1507
  spk_item = gr.Slider(
1508
  minimum=0,
@@ -1525,27 +1525,27 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1525
  with gr.Row():
1526
  dropbox = gr.File(label="Drag your audio file and click refresh.")
1527
  with gr.Row():
1528
- record_button=gr.Audio(source="microphone", label="Or you can use your microphone!", type="filepath")
1529
  with gr.Row():
1530
  input_audio0 = gr.Dropdown(
1531
- label="2.Choose the audio file.",
1532
- value="./audios/Test_Audio.mp3",
1533
  choices=audio_files
1534
  )
1535
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1536
  dropbox.upload(fn=change_choices2, inputs=[], outputs=[input_audio0])
1537
- refresh_button2 = gr.Button("Refresh", variant="primary", size='sm')
1538
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1539
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1540
  with gr.Row():
1541
  with gr.Accordion('ElevenLabs / Google TTS', open=False):
1542
  with gr.Column():
1543
- lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['en','it','es','fr','pt','zh-CN','de','hi','ja'], value='en')
1544
- api_box = gr.Textbox(label="Enter your API Key for ElevenLabs, or leave empty to use GoogleTTS", value='')
1545
- elevenid=gr.Dropdown(label="Voice:", choices=eleven_voices)
1546
  with gr.Column():
1547
- tfs = gr.Textbox(label="Input your Text", interactive=True, value="Isso é um teste.")
1548
- tts_button = gr.Button(value="Speak")
1549
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
1550
  with gr.Row():
1551
  with gr.Accordion('Wav2Lip', open=False, visible=False):
@@ -1571,17 +1571,17 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1571
 
1572
  with gr.Accordion('Edge-TTS', open=True):
1573
  with gr.Column():
1574
- ilariaid=gr.Dropdown(label="Voice:", choices=ilariavoices, value="Brazilian-Antonio- (Male)")
1575
- ilariatext = gr.Textbox(label="Input your Text", interactive=True, value="Isso é um teste.")
1576
- ilariatts_button = gr.Button(value="Speak")
1577
  ilariatts_button.click(fn=ilariaTTS, inputs=[ilariatext, ilariaid], outputs=[record_button, input_audio0])
1578
 
1579
  #with gr.Column():
1580
- with gr.Accordion("Index Settings", open=False):
1581
  #with gr.Row():
1582
 
1583
  file_index1 = gr.Dropdown(
1584
- label="3. Choose the index file (in case it wasn't automatically found.)",
1585
  choices=get_indexes(),
1586
  value=get_index(),
1587
  interactive=True,
@@ -1598,16 +1598,16 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1598
  index_rate1 = gr.Slider(
1599
  minimum=0,
1600
  maximum=1,
1601
- label=i18n("检索特征占比"),
1602
  value=0.66,
1603
  interactive=True,
1604
  )
1605
 
1606
  animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1607
 
1608
- with gr.Accordion("Advanced Options", open=False):
1609
  f0method0 = gr.Radio(
1610
- label="Optional: Change the Pitch Extraction Algorithm. Extraction methods are sorted from 'worst quality' to 'best quality'. If you don't know what you're doing, leave rmvpe.",
1611
  choices=["pm", "dio", "crepe-tiny", "mangio-crepe-tiny", "crepe", "harvest", "mangio-crepe", "rmvpe"], # Fork Feature. Add Crepe-Tiny
1612
  value="rmvpe",
1613
  interactive=True,
@@ -1626,7 +1626,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1626
  filter_radius0 = gr.Slider(
1627
  minimum=0,
1628
  maximum=7,
1629
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤���,数值为滤波半径,使用可以削弱哑音"),
1630
  value=3,
1631
  step=1,
1632
  interactive=True,
@@ -1643,22 +1643,22 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1643
  rms_mix_rate0 = gr.Slider(
1644
  minimum=0,
1645
  maximum=1,
1646
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1647
  value=0.21,
1648
  interactive=True,
1649
  )
1650
  protect0 = gr.Slider(
1651
  minimum=0,
1652
  maximum=0.5,
1653
- label=i18n("保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"),
1654
  value=0.33,
1655
  step=0.01,
1656
  interactive=True,
1657
  )
1658
  formanting = gr.Checkbox(
1659
  value=bool(DoFormant),
1660
- label="[EXPERIMENTAL] Formant shift inference audio",
1661
- info="Used for male to female and vice-versa conversions",
1662
  interactive=True,
1663
  visible=True,
1664
  )
@@ -1846,14 +1846,14 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
1846
  [vc_output3],
1847
  )
1848
  but1.click(fn=lambda: easy_uploader.clear())
1849
- with gr.TabItem("Download Voice Models"):
1850
  with gr.Row():
1851
  url=gr.Textbox(label="Huggingface Link:")
1852
  with gr.Row():
1853
- model = gr.Textbox(label="Name of the model (without spaces):")
1854
- download_button=gr.Button("Download")
1855
  with gr.Row():
1856
- status_bar=gr.Textbox(label="Download Status")
1857
  download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
1858
  with gr.Row():
1859
  gr.Markdown(
 
1327
 
1328
  def download_from_url(url, model):
1329
  if url == '':
1330
+ return "O URL não pode ficar vazio."
1331
  if model =='':
1332
+ return "Você precisa nomear seu modelo. Por exemplo: Meu modelo"
1333
  url = url.strip()
1334
  zip_dirs = ["zips", "unzips"]
1335
  for directory in zip_dirs:
 
1363
  shutil.copy(file_path,f'./weights/{model}.pth')
1364
  shutil.rmtree("zips")
1365
  shutil.rmtree("unzips")
1366
+ return "Modelo baixado, você pode voltar para a página de inferência!"
1367
  except:
1368
+ return "ERRO - O download falhou. Verifique se o link é válido."
1369
  def success_message(face):
1370
+ return f'{face.name} foi carregado.', 'None'
1371
  def mouth(size, face, voice, faces):
1372
  if size == 'Half':
1373
  size = 2
 
1481
  else:
1482
  return f'./weights/{model}.pth', "Could not find Index file."
1483
 
1484
+ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"), title="RVC - AI HUB BRASIL :flag_br:") as app:
1485
  with gr.Tabs():
1486
  with gr.TabItem("Inference"):
1487
+ gr.HTML("<h1> RVC - AI HUB BRASIL :flag_br: </h1>")
1488
  gr.HTML("<h10> Você pode encontrar mais modelos em AI Hub: https://discord.gg/aihub <br> ou AI Hub Brasil https://discord.gg/aihubrasil </h10>")
1489
+ gr.HTML("<h4> Huggingface port by Ilaria of the Rejekt Easy GUI </h4>")
1490
 
1491
  # Inference Preset Row
1492
  # with gr.Row():
 
1498
 
1499
  # Other RVC stuff
1500
  with gr.Row():
1501
+ sid0 = gr.Dropdown(label="1. Escolha seu modelo", choices=sorted(names), value=check_for_name())
1502
+ refresh_button = gr.Button("Atualizar", variant="primary")
1503
  if check_for_name() != '':
1504
  get_vc(sorted(names)[0])
1505
+ vc_transform0 = gr.Number(label="Mude o tom aqui. Se a voz for do mesmo sexo, não é necessario alterar(12 caso seja Masculino para feminino, -12 caso seja ao contrário.", value=0)
1506
  #clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
1507
  spk_item = gr.Slider(
1508
  minimum=0,
 
1525
  with gr.Row():
1526
  dropbox = gr.File(label="Drag your audio file and click refresh.")
1527
  with gr.Row():
1528
+ record_button=gr.Audio(source="microphone", label="Ou você pode usar seu microfone!", type="filepath")
1529
  with gr.Row():
1530
  input_audio0 = gr.Dropdown(
1531
+ label="2.Escolha o arquivo de áudio",
1532
+ value="./audios/Poema-do-Cume-Arnold",
1533
  choices=audio_files
1534
  )
1535
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1536
  dropbox.upload(fn=change_choices2, inputs=[], outputs=[input_audio0])
1537
+ refresh_button2 = gr.Button("Atualizar", variant="primary", size='sm')
1538
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1539
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1540
  with gr.Row():
1541
  with gr.Accordion('ElevenLabs / Google TTS', open=False):
1542
  with gr.Column():
1543
+ lang = gr.Radio(label='Chinês e Japonês não funcionam atualmente com a ElevenLabs..',choices=['en','it','es','fr','pt','zh-CN','de','hi','ja'], value='pt')
1544
+ api_box = gr.Textbox(label="Digite sua chave de API para a ElevenLabs ou deixe em branco para usar o GoogleTTS. (Não é obrigatorio)", value='')
1545
+ elevenid=gr.Dropdown(label="Voz:", choices=eleven_voices)
1546
  with gr.Column():
1547
+ tfs = gr.Textbox(label="Digite o seu Texto", interactive=True, value="Isso é um teste.")
1548
+ tts_button = gr.Button(value="Falar")
1549
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
1550
  with gr.Row():
1551
  with gr.Accordion('Wav2Lip', open=False, visible=False):
 
1571
 
1572
  with gr.Accordion('Edge-TTS', open=True):
1573
  with gr.Column():
1574
+ ilariaid=gr.Dropdown(label="Voz:", choices=ilariavoices, value="Brazilian-Antonio- (Male)")
1575
+ ilariatext = gr.Textbox(label="Digite o seu Texto", interactive=True, value="Isso é um teste.")
1576
+ ilariatts_button = gr.Button(value="Falar")
1577
  ilariatts_button.click(fn=ilariaTTS, inputs=[ilariatext, ilariaid], outputs=[record_button, input_audio0])
1578
 
1579
  #with gr.Column():
1580
+ with gr.Accordion("Configuração de Index", open=False):
1581
  #with gr.Row():
1582
 
1583
  file_index1 = gr.Dropdown(
1584
+ label="3. Escolha o arquivo de índice (caso não tenha sido encontrado automaticamente).",
1585
  choices=get_indexes(),
1586
  value=get_index(),
1587
  interactive=True,
 
1598
  index_rate1 = gr.Slider(
1599
  minimum=0,
1600
  maximum=1,
1601
+ label=i18n("Proporção do recurso de pesquisa"),
1602
  value=0.66,
1603
  interactive=True,
1604
  )
1605
 
1606
  animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1607
 
1608
+ with gr.Accordion("Opções avançadas", open=False):
1609
  f0method0 = gr.Radio(
1610
+ label="Opcional: altere o algoritmo de extração de pitch. Os métodos de extração são classificados da “pior qualidade” para a “melhor qualidade”. Se você não sabe o que está fazendo, saia do rmvpe.",
1611
  choices=["pm", "dio", "crepe-tiny", "mangio-crepe-tiny", "crepe", "harvest", "mangio-crepe", "rmvpe"], # Fork Feature. Add Crepe-Tiny
1612
  value="rmvpe",
1613
  interactive=True,
 
1626
  filter_radius0 = gr.Slider(
1627
  minimum=0,
1628
  maximum=7,
1629
+ label=i18n(">=3, use filtragem mediana no resultado do reconhecimento do tom de colheita, o valor é o raio do filtro, o que pode enfraquecer o som mudo."),
1630
  value=3,
1631
  step=1,
1632
  interactive=True,
 
1643
  rms_mix_rate0 = gr.Slider(
1644
  minimum=0,
1645
  maximum=1,
1646
+ label=i18n("O envelope do volume da fonte de entrada substitui a taxa de fusão do envelope do volume de saída. Quanto mais próximo estiver de 1, mais envelope de saída será usado."),
1647
  value=0.21,
1648
  interactive=True,
1649
  )
1650
  protect0 = gr.Slider(
1651
  minimum=0,
1652
  maximum=0.5,
1653
+ label=i18n("Proteja consoantes surdas e sons respiratórios para evitar artefatos, como quebra de som eletrônico. Não ative quando atingir 0,5. Abaixe-o para aumentar a proteção, mas pode reduzir o efeito de indexação."),
1654
  value=0.33,
1655
  step=0.01,
1656
  interactive=True,
1657
  )
1658
  formanting = gr.Checkbox(
1659
  value=bool(DoFormant),
1660
+ label="[EXPERIMENTAL] Áudio de inferência de mudança de formante",
1661
+ info="Usado para conversões de homem para mulher e vice-versa",
1662
  interactive=True,
1663
  visible=True,
1664
  )
 
1846
  [vc_output3],
1847
  )
1848
  but1.click(fn=lambda: easy_uploader.clear())
1849
+ with gr.TabItem("Baixar novos modelos"):
1850
  with gr.Row():
1851
  url=gr.Textbox(label="Huggingface Link:")
1852
  with gr.Row():
1853
+ model = gr.Textbox(label="Nome do modelo (Sem espaços):")
1854
+ download_button=gr.Button("Baixar")
1855
  with gr.Row():
1856
+ status_bar=gr.Textbox(label="Status do download")
1857
  download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
1858
  with gr.Row():
1859
  gr.Markdown(