jlopez00's picture
Upload folder using huggingface_hub
c6fd5b2 verified
raw
history blame
1.45 kB
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],
)