pr0fixi commited on
Commit
186f296
·
verified ·
1 Parent(s): 147273c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from TTS.api import TTS
3
+
4
+ # Initialize Coqui XTTS-v2
5
+ tts = TTS(model_name="coqui/XTTS-v2", progress_bar=False)
6
+
7
+ def generate_speech(text):
8
+ output_file = "output.wav"
9
+ tts.tts_to_file(text=text, file_path=output_file)
10
+ return output_file
11
+
12
+ # Create a Gradio interface
13
+ iface = gr.Interface(
14
+ fn=generate_speech,
15
+ inputs="text",
16
+ outputs="audio",
17
+ title="Coqui XTTS-v2 Demo",
18
+ description="Type some text and hear it spoken!"
19
+ )
20
+
21
+ iface.launch()