tonytz commited on
Commit
0ece115
1 Parent(s): 580f3ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -1,7 +1,28 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="audio")
7
  iface.launch()
 
1
  import gradio as gr
2
+ from gtts import gTTS
3
+ import os
4
 
5
+ def swahiliTTs(mytext):
6
+ obj = gTTS(text=mytext, lang="sw", slow=False)
7
+ obj.save("demo.mp3")
8
+ return "demo.mp3"
9
+
10
+ examples = [
11
+ ["Mama yangu ni mkali sana lakini hunifunza tabia njema kila wakati"],
12
+ ["Siku kama ya leo mwaka jana nilikuwa mbali na familia yangu kiasi ambacho niliikumbuka sana"]
13
+ ]
14
+
15
+ iface = gr.Interface(fn = swahiliTTs,
16
+ inputs = "text",
17
+ outputs = 'audio',
18
+ verbose = True,
19
+ title = 'Swahili Text to Speech Demo Application',
20
+ description = 'A simple application to convert Swahili text into audio speech. Type your Swahili text',
21
+ article =
22
+ '''<div>
23
+ <p style="text-align: center"> 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.</p>
24
+ </div>''',
25
+ examples=examples
26
+ )
27
 
 
28
  iface.launch()