shujjat commited on
Commit
4342a17
·
verified ·
1 Parent(s): 62dcee5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -1,3 +1,22 @@
1
  import gradio as gr
 
2
 
3
- gr.load("models/Nithu/text-to-speech").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load the TTS model
5
+ tts = pipeline("text-to-speech")
6
+
7
+ def text_to_speech(text):
8
+ # Generate speech from text
9
+ audio = tts(text)
10
+ return audio["audio"]
11
+
12
+ # Create a Gradio interface
13
+ iface = gr.Interface(
14
+ fn=text_to_speech,
15
+ inputs="text",
16
+ outputs="audio",
17
+ title="Text to Speech",
18
+ description="Convert text to speech using Hugging Face Transformers."
19
+ )
20
+
21
+ # Launch the interface
22
+ iface.launch()