Yusin commited on
Commit
eef851c
1 Parent(s): 96a6898

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -50,18 +50,20 @@ def chat_hf(audio, custom_token, language):
50
  else:
51
  #gpt_response = chatbot.ask(whisper_text, conversation_id=conversation_id, parent_id=None)
52
  print(whisper_text)
53
- if chat_id['conversation_id'] != None:
54
- data = {"content": whisper_text, "conversation_id": chat_id['conversation_id'], "parent_id": chat_id['parent_id']}
55
- else:
56
- data = {"content": whisper_text}
57
- print(data)
58
- res = requests.get('http://myip.ipip.net', timeout=5).text
59
- print(res)
60
- response = requests.post('api_endpoint', headers=headers, json=data, verify=False, timeout=5)
61
- print('this is my answear', response.text)
62
- chat_id['parent_id'] = response.json()["response_id"]
63
- chat_id['conversation_id'] = response.json()["conversation_id"]
64
- gpt_response = response.json()["content"]
 
 
65
 
66
  #whisper_text = translate(audio)
67
  #api = ChatGPT(session_token)
 
50
  else:
51
  #gpt_response = chatbot.ask(whisper_text, conversation_id=conversation_id, parent_id=None)
52
  print(whisper_text)
53
+ #if chat_id['conversation_id'] != None:
54
+ # data = {"content": whisper_text, "conversation_id": chat_id['conversation_id'], "parent_id": chat_id['parent_id']}
55
+ #else:
56
+ # data = {"content": whisper_text}
57
+ #print(data)
58
+ #res = requests.get('http://myip.ipip.net', timeout=5).text
59
+ #print(res)
60
+ #response = requests.post('api_endpoint', headers=headers, json=data, verify=False, timeout=5)
61
+ #print('this is my answear', response.text)
62
+ #chat_id['parent_id'] = response.json()["response_id"]
63
+ #chat_id['conversation_id'] = response.json()["conversation_id"]
64
+ #gpt_response = response.json()["content"]
65
+ response = requests.get('https://api.pawan.krd/chat/gpt?text=' + whisper_text)
66
+ print(response.text)
67
 
68
  #whisper_text = translate(audio)
69
  #api = ChatGPT(session_token)