Spaces:
Runtime error
Runtime error
File size: 1,451 Bytes
c6fd5b2 |
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 62 |
import logging
import gradio as gr
from tts_service.functions import fetch_document, generate_speech_from_text
from tts_service.voices import voice_manager
log = logging.getLogger(__name__)
# TTS tab
def workflow_tab():
with gr.Row():
with gr.Column():
source = gr.Textbox(
label="Source",
info="Enter the document ID or URL.",
)
fetch_button = gr.Button("Fetch")
text = gr.Textbox(
label="Text",
visible=False,
)
voice = gr.Dropdown(
label="Voice",
choices=voice_manager.voices.keys(),
value=voice_manager.voice_names[0],
visible=len(voice_manager.voices) > 1,
)
synthesize_button = gr.Button("Synthesize")
audio = gr.Audio(
label="Generated Audio",
)
status = gr.Markdown(
label="Status",
show_label=True,
)
with gr.Column():
markdown = gr.Markdown(
label="Document",
show_label=True,
)
fetch_button.click(
fn=fetch_document,
inputs=[source],
outputs=[markdown, text],
)
synthesize_button.click(
fn=generate_speech_from_text,
inputs=[text, voice],
outputs=[status, audio],
)
|