broadfield-dev commited on
Commit
b1b38a4
·
verified ·
1 Parent(s): 45249de

Adding file test: output.mp3"

Browse files

tts.save(filename)
return filename

iface = gr.Interface(
fn=text_to_speech

output.mp3/"/n tts.save(filename)/n return filename/n/niface = gr.Interface(/n fn=text_to_speech ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gtts import gTTS
3
+ import os
4
+
5
+ def text_to_speech(text):
6
+ tts = gTTS(text=text, lang='en')
7
+ filename = "output.mp3"
8
+ tts.save(filename)
9
+ return filename
10
+
11
+ iface = gr.Interface(
12
+ fn=text_to_speech,
13
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Enter text here..."),
14
+ outputs=gr.outputs.Audio(type="filepath", label="Speech Output"),
15
+ title="Text to Speech Converter",
16
+ description="Convert your text to speech using this Gradio app!"
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ iface.launch()