Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import telnetlib
|
|
7 |
#import whisper
|
8 |
#whisper_model = whisper.load_model("small")
|
9 |
whisper = gr.Interface.load(name="spaces/sanchit-gandhi/whisper-large-v2")
|
10 |
-
|
11 |
import os
|
12 |
import json
|
13 |
session_token = os.environ.get('SessionToken')
|
@@ -91,10 +91,11 @@ async def chat_gpt_ask(prompt):
|
|
91 |
|
92 |
# ChatGPT
|
93 |
def chat_hf(audio, custom_token, language):
|
94 |
-
|
95 |
-
|
96 |
-
whisper_text = translate(audio)
|
97 |
-
gpt_response = asyncio.run(async_main(whisper_text))
|
|
|
98 |
try:
|
99 |
whisper_text = translate(audio)
|
100 |
if whisper_text == "ERROR: You have to either use the microphone or upload an audio file":
|
@@ -137,7 +138,7 @@ def chat_hf(audio, custom_token, language):
|
|
137 |
#api.refresh_auth() # refresh the authorization token
|
138 |
#api.reset_conversation() # reset the conversation
|
139 |
#gpt_response = resp['message']
|
140 |
-
|
141 |
# to voice
|
142 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
143 |
coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
|
|
|
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 |
import os
|
12 |
import json
|
13 |
session_token = os.environ.get('SessionToken')
|
|
|
91 |
|
92 |
# ChatGPT
|
93 |
def chat_hf(audio, custom_token, language):
|
94 |
+
output = chatgpt(audio, "transcribe", fn_index=0)
|
95 |
+
whisper_text, gpt_response = output[0], output[1]
|
96 |
+
#whisper_text = translate(audio)
|
97 |
+
#gpt_response = asyncio.run(async_main(whisper_text))
|
98 |
+
'''
|
99 |
try:
|
100 |
whisper_text = translate(audio)
|
101 |
if whisper_text == "ERROR: You have to either use the microphone or upload an audio file":
|
|
|
138 |
#api.refresh_auth() # refresh the authorization token
|
139 |
#api.reset_conversation() # reset the conversation
|
140 |
#gpt_response = resp['message']
|
141 |
+
'''
|
142 |
# to voice
|
143 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
144 |
coquiTTS.get_tts(gpt_response, fp, speaker = {"language" : language})
|