Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,18 @@
|
|
1 |
-
import
|
2 |
import gradio as gr
|
3 |
-
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
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()
|