File size: 476 Bytes
d5085a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# app.py

from gtts import gTTS
import gradio as gr
import os

def text_to_speech(text):
    tts = gTTS(text)
    tts.save("output.mp3")
    return "output.mp3"

interface = gr.Interface(
    fn=text_to_speech,
    inputs=gr.Textbox(lines=3, label="Enter Text"),
    outputs=gr.Audio(type="filepath", label="Generated Speech"),
    title="Text to Speech App",
    description="Enter any English text and listen to the speech output."
)

interface.launch()