Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import gtts
|
| 3 |
+
|
| 4 |
+
def tts_interface(input_text):
|
| 5 |
+
tts = gtts.gTTS(input_text)
|
| 6 |
+
tts.save("output.mp3")
|
| 7 |
+
return "output.mp3"
|
| 8 |
+
|
| 9 |
+
iface = gr.Interface(
|
| 10 |
+
fn=tts_interface,
|
| 11 |
+
inputs=gr.inputs.Textbox(lines=5),
|
| 12 |
+
outputs=gr.outputs.Audio(),
|
| 13 |
+
title="Text-to-Speech Converter",
|
| 14 |
+
description="Enter a text and get its spoken version as an MP3 file."
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
iface.launch()
|