SwahiliTTS / app.py
tonytz's picture
Update app.py
f725b52
import gradio as gr
from gtts import gTTS
import os
def swahiliTTs(swahilitext):
obj = gTTS(text=swahilitext, lang="sw", slow=True)
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 =
'''<div>
<p style="text-align: center"> All you need to do is to type Swahili text 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.</p>
</div>''',
examples=examples
)
iface.launch()