text-to-speech / app.py
vishal2002's picture
Update app.py
2d095ee verified
raw
history blame
326 Bytes
import gradio as gr
from gtts import gTTS
import tempfile
import os
def text_to_speech(text):
tts = gTTS(text=text, lang='en')
_, temp_path = tempfile.mkstemp(suffix=".mp3")
tts.save(temp_path)
return temp_path
iface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio")
iface.launch(share=True)