import gradio as gr from gtts import gTTS import os def swahiliTTs(mytext): obj = gTTS(text=mytext, lang="sw", slow=False) obj.save("demo.mp3") return "demo.mp3" examples = [ ["Mama yangu ni mkali sana lakini hunifunza tabia njema kila wakati"], ["Siku kama ya leo mwaka jana nilikuwa mbali na familia yangu kiasi ambacho niliikumbuka sana"] ] iface = gr.Interface(fn = swahiliTTs, inputs = "text", outputs = 'audio', verbose = True, title = 'Swahili Text to Speech Demo Application', description = 'A simple application to convert Swahili text into audio speech. Type your Swahili text', article = '''
All you need to do is to upload the pdf file and hit submit, then wait for compiling. After that click on Play/Pause to listing to the audio. The audio is saved in an mp3 format.