antoniomae1234's picture
Update app.py
b33d732 verified
raw
history blame contribute delete
No virus
326 Bytes
import gradio as gr
from gtts import gTTS
import tempfile
import os
def text_to_speech(text):
tts = gTTS(text=text, lang='pt')
_, 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)