Samit-khedekar commited on
Commit
a3b55d1
·
verified ·
1 Parent(s): d15e0e3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from TTS.api import TTS
3
+
4
+ # Load TTS model (first time might take 1–2 minutes)
5
+ tts = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC", progress_bar=True, gpu=False)
6
+
7
+ def synthesize(text):
8
+ output_path = "output.wav"
9
+ tts.tts_to_file(text=text, file_path=output_path)
10
+ return output_path
11
+
12
+ # Gradio UI
13
+ gr.Interface(
14
+ fn=synthesize,
15
+ inputs=gr.Textbox(label="Enter text to synthesize"),
16
+ outputs=gr.Audio(type="filepath", label="Generated Audio"),
17
+ title="🗣️ Coqui TTS - CPU Demo",
18
+ description="Enter text and generate speech using Coqui's Tacotron2-DDC model (free and fast).",
19
+ ).launch()