mikuTTS / app.py
nevreal's picture
Update app.py
150d7c2 verified
import gradio as gr
from rvc import *
initial_md = """
# MIKU TTS - 5.0.1
"""
app = gr.Blocks(theme='NoCrypt/miku')
with app:
gr.Markdown(initial_md)
with gr.Row():
with gr.Column():
model_name = gr.Dropdown(label="Model",choices=models,value=models[0])
f0_key_up = gr.Number(label="Tune",value=6)
with gr.Column():
f0_method = gr.Radio(label="Pitch extraction method (pm: very fast, low quality, rmvpe: a little slow, high quality)",choices=["pm", "rmvpe"], value="rmvpe",visible=False)
index_rate = gr.Slider(minimum=0,maximum=1,label="Index rate",value=1,interactive=True)
protect0 = gr.Slider(minimum=0,maximum=0.5,label="Protect",value=0.33,step=0.01,interactive=True)
with gr.Row():
with gr.Column():
tts_voice = gr.Dropdown(
label="Edge-tts speaker (format: language-Country-Name-Gender), make sure the gender matches the model",
choices=tts_voices,
allow_custom_value=False,
value="ja-JP-NanamiNeural-Female",
)
speed = gr.Slider(
minimum=-100,
maximum=100,
label="Speech speed (%)",
value=0,
step=10,
interactive=True,
)
tts_text = gr.Textbox(label="Input Text", value="こんにちは、私の名前は初音ミクです!")
with gr.Column():
but0 = gr.Button("Convert", variant="primary")
info_text = gr.Textbox(label="Output info")
with gr.Column():
with gr.Accordion("Edge Voice", visible=False):
edge_tts_output = gr.Audio(label="Edge Voice", type="filepath")
tts_output = gr.Audio(label="Result")
but0.click(
tts,
[
model_name,
speed,
tts_text,
tts_voice,
f0_key_up,
f0_method,
index_rate,
protect0,
],
[info_text, edge_tts_output, tts_output],
)
with gr.Row():
examples = gr.Examples(
examples_per_page=100,
examples=[
["こんにちは、私の名前は初音ミクです!", "ja-JP-NanamiNeural-Female", 6],
["Hello there. My name is Hatsune Miku!","en-CA-ClaraNeural-Female", 6],
["Halo. Nama saya Hatsune Miku!","id-ID-GadisNeural-Female", 4],
["Halo. Jenengku Hatsune Miku!","jv-ID-SitiNeural-Female", 10],
],
inputs=[tts_text, tts_voice, f0_key_up],
)
app.launch()