Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import tempfile
|
2 |
import gradio as gr
|
3 |
from neon_tts_plugin_coqui import CoquiTTS
|
4 |
-
|
5 |
-
|
6 |
|
7 |
# ChatGPT
|
8 |
from pyChatGPT import ChatGPT
|
@@ -15,7 +15,7 @@ title = "Speech to ChatGPT to Speech"
|
|
15 |
#info = "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)"
|
16 |
#badge = "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=neongeckocom.neon-tts-plugin-coqui"
|
17 |
|
18 |
-
coquiTTS = CoquiTTS()
|
19 |
|
20 |
|
21 |
# ChatGPT
|
@@ -39,7 +39,10 @@ def chat_hf(audio, custom_token, language):
|
|
39 |
gpt_response = resp['message']
|
40 |
|
41 |
# to voice
|
|
|
|
|
42 |
|
|
|
43 |
|
44 |
# whisper
|
45 |
def translate(audio):
|
|
|
1 |
import tempfile
|
2 |
import gradio as gr
|
3 |
from neon_tts_plugin_coqui import CoquiTTS
|
4 |
+
LANGUAGES = list(CoquiTTS.langs.keys())
|
5 |
+
default_lang = "en"
|
6 |
|
7 |
# ChatGPT
|
8 |
from pyChatGPT import ChatGPT
|
|
|
15 |
#info = "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)"
|
16 |
#badge = "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=neongeckocom.neon-tts-plugin-coqui"
|
17 |
|
18 |
+
#coquiTTS = CoquiTTS()
|
19 |
|
20 |
|
21 |
# ChatGPT
|
|
|
39 |
gpt_response = resp['message']
|
40 |
|
41 |
# to voice
|
42 |
+
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
43 |
+
coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
|
44 |
|
45 |
+
return whisper_text, gpt_response, fp.name
|
46 |
|
47 |
# whisper
|
48 |
def translate(audio):
|