Spaces:
Runtime error
Runtime error
from pathlib import Path | |
import gradio as gr | |
from assets.i18n.i18n import I18nAuto | |
from tts_service.tts import run_tts_script | |
from tts_service.voices import voice_manager | |
i18n = I18nAuto() | |
sample = Path("notebooks/sample.txt").read_text() | |
# TTS tab | |
def tts_tab(): | |
with gr.Column(): # noqa: SIM117 | |
with gr.Row(): | |
voice_name = gr.Dropdown( | |
label=i18n("Voice Model"), | |
info=i18n("Select the voice model."), | |
choices=voice_manager.voice_names, | |
value=voice_manager.voice_names[0], | |
) | |
tts_rate = gr.Slider( | |
minimum=-100, | |
maximum=100, | |
step=1, | |
label=i18n("TTS Speed"), | |
info=i18n("Increase or decrease TTS speed."), | |
value=0, | |
interactive=True, | |
) | |
tts_text = gr.Textbox( | |
label=i18n("Text to Synthesize"), | |
info=i18n("Enter the text to synthesize."), | |
placeholder=i18n("Enter text to synthesize"), | |
value=sample, | |
lines=3, | |
) | |
convert_button = gr.Button(i18n("Convert")) | |
with gr.Row(): | |
vc_output1 = gr.Textbox( | |
label=i18n("Output Information"), | |
info=i18n("The output information will be displayed here."), | |
) | |
vc_output2 = gr.Audio(label=i18n("Generated Audio")) | |
convert_button.click( | |
fn=run_tts_script, | |
inputs=[ | |
tts_text, | |
voice_name, | |
tts_rate, | |
], | |
outputs=[vc_output1, vc_output2], | |
) | |