Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,21 @@ title = "Speech to ChatGPT to Speech"
|
|
22 |
coquiTTS = CoquiTTS()
|
23 |
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
# ChatGPT
|
26 |
def chat_hf(audio, custom_token, language):
|
|
|
27 |
try:
|
28 |
whisper_text = translate(audio)
|
29 |
if whisper_text == "ERROR: You have to either use the microphone or upload an audio file":
|
|
|
22 |
coquiTTS = CoquiTTS()
|
23 |
|
24 |
|
25 |
+
import asyncio
|
26 |
+
from pygpt import PyGPT
|
27 |
+
|
28 |
+
async def main():
|
29 |
+
chat_gpt = PyGPT('eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..gTz2d7cx1hwglfBr.QpbVoYL9nXFW2P-Rf1OTv_6kig7Mt55ub1qI1a5snnLqWlZjFWLWlIvdHqZCkhosloLxteXwQXMSMBJU1abD1vfv1ajl6VIR5zCcR9LwBbz1zCSzhN114y1t42ec-pF5_VpsU3jssNDgjaCoaoB4QN3dkiwZ7Uq-Ge2ZYk5RhgP4ruhnXhhKF5I1w__mTsQPME3WIO4-4k1csJrB3KU_smntlPSp5IlUZ_6h0jv7lRItNblWVSdYvQ5DyYsfifbQF0GrvQlqEyWd79fU9rrv3Y7NvdYCKP5iPifr4cP7RfyI7Sg7MB2BNuYkysgT8m3XHZcVLiYr85-TcgdHcThRMx4vfb4ogEn3Jfh2TLFZbH1zmJur16JjTlWDXqZ0qjBnUqP3G9LifTLaxSNLCErC2HzgX89c3BP0mf6FIZSzkq_S_r4vblM13dfofo0VTJIufmZ5x3z8U40Va4VnLPdWcn_qLs9OnlNagcbCkvTYWyuyPSuncxhd9rc4T5n_GO6MZO21xIgT5LtNIjnSwS6dzi2hZruirmocj_DpFRARvEQeTU4C6XiZfuuye-UjmEOMVxkHiu3IybEBAVL2Odi9wLYuU3CJbZFBJ3EzAQY_q0P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is the capital of France?')
|
33 |
+
print(answer)
|
34 |
+
await chat_gpt.disconnect()
|
35 |
+
|
36 |
+
|
37 |
# ChatGPT
|
38 |
def chat_hf(audio, custom_token, language):
|
39 |
+
asyncio.run(main())
|
40 |
try:
|
41 |
whisper_text = translate(audio)
|
42 |
if whisper_text == "ERROR: You have to either use the microphone or upload an audio file":
|