Yusin commited on
Commit
556ed1d
1 Parent(s): 2df72a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -7,7 +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
- cn_a_jp = gr.Blocks.load(name="spaces/Yusin/anime-tts_yusin")
11
  #chatgpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
12
  #chatgpt = gr.Blocks.load(name="spaces/seawolf2357/chatgptclone")
13
  import os
@@ -41,14 +41,10 @@ def chat_hf(audio, custom_token, language):
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_all = cn_a_jp(gpt_response, fn_index=0)
46
- voice_out = voice_out_all[1]
47
- else:
48
- with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
49
- coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
50
- voice_out = fp.name
51
- return whisper_text, gpt_response, voice_out
52
 
53
  # whisper
54
  #def translate(audio):
 
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/Yusin/anime-tts_yusin")
11
  #chatgpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
12
  #chatgpt = gr.Blocks.load(name="spaces/seawolf2357/chatgptclone")
13
  import os
 
41
  gpt_response = """Sorry, I'm quite busy right now, but please try again later :)"""
42
 
43
  # to voice
44
+ with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
45
+ coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
46
+
47
+ return whisper_text, gpt_response, fp.name
 
 
 
 
48
 
49
  # whisper
50
  #def translate(audio):