File size: 326 Bytes
1d6c4be
e1b4aaf
 
 
1d6c4be
 
e1b4aaf
 
 
 
1d6c4be
 
2d095ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)