Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def init_TTS(config):
|
|
27 |
|
28 |
|
29 |
@spaces.GPU
|
30 |
-
def generate_speech(text):
|
31 |
# Generate speech using the provided text, speaker voice, and language
|
32 |
tts.tts_to_file(text=text,
|
33 |
file_path=config['inference']['file_path'],
|
@@ -40,36 +40,19 @@ def generate_speech(text):
|
|
40 |
def main(config):
|
41 |
|
42 |
# Create the Gradio interface
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
52 |
|
53 |
# Launch the interface
|
54 |
-
|
55 |
-
#return 0
|
56 |
-
|
57 |
-
with gr.Blocks() as demo:
|
58 |
-
gr.Markdown("# Voice Synthesis with Coqui-XTTS")
|
59 |
-
gr.Markdown("Synthesize speech using predefined target voice and language")
|
60 |
-
|
61 |
-
textbox = gr.Textbox(label="Enter your text")
|
62 |
-
tune_btn = gr.Button("Synthesize Text")
|
63 |
-
outputs = gr.outputs.Audio(type="auto", label=None)
|
64 |
-
|
65 |
-
tune_btn.click(fn=generate_speech,
|
66 |
-
inputs=[
|
67 |
-
textbox
|
68 |
-
],
|
69 |
-
outputs="audio")
|
70 |
-
|
71 |
-
demo.launch()
|
72 |
-
|
73 |
return 0
|
74 |
|
75 |
|
|
|
27 |
|
28 |
|
29 |
@spaces.GPU
|
30 |
+
def generate_speech(microphone, text):
|
31 |
# Generate speech using the provided text, speaker voice, and language
|
32 |
tts.tts_to_file(text=text,
|
33 |
file_path=config['inference']['file_path'],
|
|
|
40 |
def main(config):
|
41 |
|
42 |
# Create the Gradio interface
|
43 |
+
demo = gr.Interface(
|
44 |
+
fn=generate_speech,
|
45 |
+
inputs=[
|
46 |
+
audio_box = gr.Audio(label="Audio", sources="microphone", type="filepath", elem_id='audio'),
|
47 |
+
gr.Textbox(label="Enter your text")
|
48 |
+
],
|
49 |
+
outputs="audio",
|
50 |
+
title="Voice Synthesis with Coqui-XTTS",
|
51 |
+
description="Synthesize speech using predefined target voice and language."
|
52 |
+
)
|
53 |
|
54 |
# Launch the interface
|
55 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return 0
|
57 |
|
58 |
|