File size: 550 Bytes
d221f64 47236f5 d221f64 47236f5 5bfc6c1 d221f64 14edb03 31b4486 d221f64 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import gtts
from gtts.lang import tts_langs
def tts_interface(input_text, voice):
l,v = voice
tts = gtts.gTTS(text=input_text, lang=l)
tts.save("output.mp3")
return "output.mp3"
iface = gr.Interface(
fn=tts_interface,
inputs=[gr.inputs.Textbox(lines=5), gr.inputs.Dropdown(choices=[(k, v) for k, v in tts_langs().items()])],
outputs=gr.outputs.Audio(type="filepath"),
title="Text-to-Speech Converter",
description="Enter a text and get its spoken version as an MP3 file."
)
iface.launch() |