File size: 1,143 Bytes
412caf0
0ece115
 
412caf0
1921a11
f725b52
0ece115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1921a11
0ece115
 
 
412caf0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()