Spaces:
Configuration error
Configuration error
Adding file test: app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,21 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from gtts import gTTS
|
|
|
|
| 3 |
|
| 4 |
-
def text_to_speech(text):
|
| 5 |
-
tts = gTTS(text=text, lang=
|
| 6 |
tts.save("output.mp3")
|
| 7 |
return "output.mp3"
|
| 8 |
|
| 9 |
iface = gr.Interface(
|
| 10 |
fn=text_to_speech,
|
| 11 |
-
inputs=
|
|
|
|
|
|
|
|
|
|
| 12 |
outputs="audio",
|
| 13 |
title="Text to Speech Converter",
|
| 14 |
-
description="
|
| 15 |
)
|
| 16 |
|
| 17 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gtts import gTTS
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
+
def text_to_speech(text, lang):
|
| 6 |
+
tts = gTTS(text=text, lang=lang)
|
| 7 |
tts.save("output.mp3")
|
| 8 |
return "output.mp3"
|
| 9 |
|
| 10 |
iface = gr.Interface(
|
| 11 |
fn=text_to_speech,
|
| 12 |
+
inputs=[
|
| 13 |
+
gr.inputs.Textbox(lines=2, placeholder="Enter text here..."),
|
| 14 |
+
gr.inputs.Dropdown(choices=["en", "es", "fr", "de", "it"], label="Language", default="en")
|
| 15 |
+
],
|
| 16 |
outputs="audio",
|
| 17 |
title="Text to Speech Converter",
|
| 18 |
+
description="Convert your text to speech in multiple languages using this simple Gradio demo."
|
| 19 |
)
|
| 20 |
|
| 21 |
iface.launch()
|