Spaces:
Runtime error
Runtime error
from pathlib import Path | |
import gradio as gr | |
from tts_service.functions import generate_speech_from_text | |
from tts_service.voices import voice_manager | |
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="Voice Model", | |
info="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="TTS Speed", | |
info="Increase or decrease TTS speed.", | |
value=0, | |
interactive=True, | |
) | |
tts_text = gr.Textbox( | |
label="Text to Synthesize", | |
info="Enter the text to synthesize.", | |
placeholder="Enter text to synthesize", | |
value=sample, | |
lines=3, | |
) | |
convert_button = gr.Button("Convert") | |
with gr.Row(): | |
vc_output1 = gr.Textbox( | |
label="Output Information", | |
info="The output information will be displayed here.", | |
) | |
vc_output2 = gr.Audio(label="Generated Audio") | |
convert_button.click( | |
fn=generate_speech_from_text, | |
inputs=[ | |
tts_text, | |
voice_name, | |
tts_rate, | |
], | |
outputs=[vc_output1, vc_output2], | |
) | |