binqiangliu commited on
Commit
912877f
·
1 Parent(s): 20422fc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ def call_chatbot_api(query):
3
+ url = 'https://hf-aichat-api.onrender.com/api/chat' # /api/chat前面使用api.py部署后获得的URL
4
+ data = {'query': query}
5
+ response = requests.post(url, json=data)
6
+ result = response.json()
7
+ return result['response']
8
+ # 调用Chatbot API
9
+ user_query = "hello" # 用户查询,置于英文的""之内
10
+ response = call_chatbot_api(user_query)
11
+ print(response) # 打印Chatbot的响应