Spaces:
Runtime error
Runtime error
File size: 1,588 Bytes
b3385db a8c39f5 b3385db 1378843 a8c39f5 b3385db a8c39f5 1378843 a8c39f5 1378843 a8c39f5 1378843 a8c39f5 1378843 a8c39f5 1378843 a8c39f5 1378843 b3385db 1378843 a8c39f5 571ece7 a8c39f5 1378843 a8c39f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
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],
)
|