Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,13 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
3 |
-
import
|
4 |
-
from coqui_tts import Synthesizer
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
with open("output.wav", "wb") as f:
|
13 |
-
f.write(audio)
|
14 |
|
15 |
# def text_to_audio(text):
|
16 |
# # Generate audio from text using gTTS
|
@@ -18,7 +15,7 @@ def text_to_audio(text):
|
|
18 |
# tts.save("test.wav")
|
19 |
# return 'test.wav'
|
20 |
|
21 |
-
iface = gr.Interface(fn =
|
22 |
inputs = 'text',
|
23 |
outputs = 'audio',
|
24 |
verbose = True,
|
|
|
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
|
|
|
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,
|