Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ default_lang = "en"
|
|
7 |
#import whisper
|
8 |
#whisper_model = whisper.load_model("small")
|
9 |
whisper = gr.Interface.load(name="spaces/sanchit-gandhi/whisper-large-v2")
|
|
|
10 |
#chatgpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
|
11 |
#chatgpt = gr.Blocks.load(name="spaces/seawolf2357/chatgptclone")
|
12 |
import os
|
@@ -38,13 +39,16 @@ def chat_hf(audio, custom_token, language):
|
|
38 |
except:
|
39 |
whisper_text = translate(audio)
|
40 |
gpt_response = """Sorry, I'm quite busy right now, but please try again later :)"""
|
41 |
-
|
42 |
-
print(gpt_response)
|
43 |
# to voice
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
return whisper_text, gpt_response,
|
48 |
|
49 |
# whisper
|
50 |
#def translate(audio):
|
@@ -125,7 +129,7 @@ with gr.Blocks() as blocks:
|
|
125 |
[audio_file, custom_token, radio],
|
126 |
[text1, text2, audio],
|
127 |
)
|
128 |
-
radio.change(lambda lang: CoquiTTS.langs[lang]["sentence"], radio, text2)
|
129 |
|
130 |
|
131 |
blocks.launch(debug=True)
|
|
|
7 |
#import whisper
|
8 |
#whisper_model = whisper.load_model("small")
|
9 |
whisper = gr.Interface.load(name="spaces/sanchit-gandhi/whisper-large-v2")
|
10 |
+
cn_a_jp = gr.Blocks.load(name="spaces/kouenYoung/anime-tts")
|
11 |
#chatgpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
|
12 |
#chatgpt = gr.Blocks.load(name="spaces/seawolf2357/chatgptclone")
|
13 |
import os
|
|
|
39 |
except:
|
40 |
whisper_text = translate(audio)
|
41 |
gpt_response = """Sorry, I'm quite busy right now, but please try again later :)"""
|
42 |
+
|
|
|
43 |
# to voice
|
44 |
+
if language = 'cn' or 'jp':
|
45 |
+
_, (_, voice_out) = cn_a_jp(gpt_response, "小茸", fn_index=0)
|
46 |
+
else:
|
47 |
+
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
48 |
+
coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
|
49 |
+
voice_out = fp.name
|
50 |
|
51 |
+
return whisper_text, gpt_response, voice_out
|
52 |
|
53 |
# whisper
|
54 |
#def translate(audio):
|
|
|
129 |
[audio_file, custom_token, radio],
|
130 |
[text1, text2, audio],
|
131 |
)
|
132 |
+
#radio.change(lambda lang: CoquiTTS.langs[lang]["sentence"], radio, text2)
|
133 |
|
134 |
|
135 |
blocks.launch(debug=True)
|