text_to_speech / app.py
Usman06's picture
Upload 2 files
d5085a3 verified
raw
history blame contribute delete
476 Bytes
# 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()