Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +20 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
+
from gtts import gTTS
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
def text_to_speech(text):
|
| 8 |
+
tts = gTTS(text)
|
| 9 |
+
tts.save("output.mp3")
|
| 10 |
+
return "output.mp3"
|
| 11 |
+
|
| 12 |
+
interface = gr.Interface(
|
| 13 |
+
fn=text_to_speech,
|
| 14 |
+
inputs=gr.Textbox(lines=3, label="Enter Text"),
|
| 15 |
+
outputs=gr.Audio(type="filepath", label="Generated Speech"),
|
| 16 |
+
title="Text to Speech App",
|
| 17 |
+
description="Enter any English text and listen to the speech output."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
interface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
gTTS
|