-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (38 loc) · 1.16 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from flask import Flask, redirect, render_template,request, url_for, jsonify
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from gpt import query
app = Flask(__name__)
Bootstrap(app)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/submit', methods=['GET', 'POST'])
def submit():
# get form data
if request.method == 'POST':
data = request.get_json()
result = query(data)
print("Result",result)
return jsonify(data = {
'result': result
})
@app.route('/result', methods=['GET', 'POST'])
def result():
return render_template('result.html')
@app.route('/register', methods=['GET', 'POST'])
def register():
if request.method == 'POST':
# get form data
data = request.get_json()
print(data)
return render_template('register.html')
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
# get form data
data = request.get_json()
print(data)
return render_template('login.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000,debug=True)