|
|
|
|
|
|
|
|
|
|
|
from gtts import gTTS |
|
import gradio as gr |
|
|
|
|
|
def text_to_audio(mytext): |
|
|
|
tts = gTTS(text=mytext, lang='en') |
|
|
|
filename = "output.mp3" |
|
tts.save(filename) |
|
return filename |
|
|
|
|
|
def gradio_interface(text): |
|
audio_file = text_to_audio(text) |
|
return audio_file |
|
|
|
|
|
iface = gr.Interface( |
|
fn=gradio_interface, |
|
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."), |
|
outputs=gr.Audio(type="filepath"), |
|
title="Text to Speech Application (English audio)", |
|
description="Type your text and to generate the corresponding audio in English." |
|
) |
|
|
|
|
|
iface.launch(share=True) |