binqiangliu commited on
Commit
e05e51c
·
1 Parent(s): 7c83c7e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -3
main.py CHANGED
@@ -47,7 +47,8 @@ llm_chain = LLMChain(llm=llm, prompt=PromptTemplate.from_template(prompt_templat
47
  # 定义API端点
48
  app = Flask(__name__)
49
  @app.route('/api/chat', methods=['POST'])
50
- def chat():
 
51
  data = request.get_json()
52
  #user_query = data['query']
53
  #此处的['query']中的query可以自定义名称,例如修改为user_question,那么调用API的代码中,需要相应的使用data = {'user_question': user_query},user_question需一致
@@ -56,6 +57,7 @@ def chat():
56
  initial_response = llm_chain.run(user_query)
57
  return jsonify({'response': initial_response})
58
 
59
- #if __name__ == "__main__":
60
  # uvicorn.run(app, host='0.0.0.0', port=5000)
61
- #app.run(host='0.0.0.0')
 
 
47
  # 定义API端点
48
  app = Flask(__name__)
49
  @app.route('/api/chat', methods=['POST'])
50
+ #def chat():
51
+ async def chat():
52
  data = request.get_json()
53
  #user_query = data['query']
54
  #此处的['query']中的query可以自定义名称,例如修改为user_question,那么调用API的代码中,需要相应的使用data = {'user_question': user_query},user_question需一致
 
57
  initial_response = llm_chain.run(user_query)
58
  return jsonify({'response': initial_response})
59
 
60
+ if __name__ == "__main__":
61
  # uvicorn.run(app, host='0.0.0.0', port=5000)
62
+ #app.run(host='0.0.0.0')
63
+ app.run(host='0.0.0.0', port=10000)