binqiangliu commited on
Commit
e3cd3c2
·
1 Parent(s): 81e4aaa

Rename app.py to main.py

Browse files
Files changed (1) hide show
  1. app.py → main.py +9 -8
app.py → main.py RENAMED
@@ -4,7 +4,7 @@ import os
4
  from dotenv import load_dotenv
5
  load_dotenv()
6
 
7
- app = flask.Flask(__name__, template_folder="./")
8
 
9
  # 定义API端点
10
  #app = Flask(__name__)
@@ -15,18 +15,19 @@ app = flask.Flask(__name__, template_folder="./")
15
  #@app.route('/api/chat', methods=['POST'])
16
  #...
17
 
18
- @app.route('/')
19
- def index():
20
- return flask.render_template('index.html')
21
- #app = flask(__name__)
22
  @app.route('/api/chat', methods=['POST'])
23
  def chat():
24
- incoming = request.get_json()
25
- print(incoming)
 
26
  initial_response="hello"
27
  #return jsonify({'response': initial_response})
28
  return {'response': initial_response}
29
 
30
  if __name__ == '__main__':
31
  #app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
32
- app.run(host='0.0.0.0', port=7860)
 
4
  from dotenv import load_dotenv
5
  load_dotenv()
6
 
7
+ #app = flask.Flask(__name__, template_folder="./")
8
 
9
  # 定义API端点
10
  #app = Flask(__name__)
 
15
  #@app.route('/api/chat', methods=['POST'])
16
  #...
17
 
18
+ #@app.route('/')
19
+ #def index():
20
+ # return flask.render_template('index.html')
21
+ app = flask(__name__)
22
  @app.route('/api/chat', methods=['POST'])
23
  def chat():
24
+ data = request.get_json()
25
+ user_query = data['user_question']
26
+ print(user_query)
27
  initial_response="hello"
28
  #return jsonify({'response': initial_response})
29
  return {'response': initial_response}
30
 
31
  if __name__ == '__main__':
32
  #app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
33
+ app.run(host='0.0.0.0', port=7860)