ragha108 commited on
Commit
622f99a
1 Parent(s): 554a6b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -1,24 +1,18 @@
1
- import tempfile
2
  import gradio as gr
3
- from neon_tts_plugin_coqui import CoquiTTS
4
 
5
- coquiTTS = CoquiTTS()
 
 
 
 
6
 
7
- def tts(text: str):
8
- with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
9
- coquiTTS.get_tts(text, fp)
10
- return fp.name
11
 
12
- # def text_to_audio(text):
13
- # # Generate audio from text using gTTS
14
- # tts = gTTS(text=text, lang='en', slow=False)
15
- # tts.save("test.wav")
16
- # return 'test.wav'
17
-
18
- iface = gr.Interface(fn = tts,
19
  inputs = 'text',
20
  outputs = 'audio',
21
  verbose = True,
22
  )
23
 
24
- iface.launch()
 
1
+ from gtts import gTTS
2
  import gradio as gr
3
+ import os
4
 
5
+ def text_to_audio(text):
6
+ # Generate audio from text using gTTS
7
+ tts = gTTS(text=text, lang='en', tld="co.in",slow=False)
8
+ tts.save("test.wav")
9
+ return 'test.wav'
10
 
 
 
 
 
11
 
12
+ iface = gr.Interface(fn = text_to_audio,
 
 
 
 
 
 
13
  inputs = 'text',
14
  outputs = 'audio',
15
  verbose = True,
16
  )
17
 
18
+ iface.launch()