forked from vilasvarghese/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreqres.py
More file actions
executable file
·22 lines (17 loc) · 729 Bytes
/
Copy pathreqres.py
File metadata and controls
executable file
·22 lines (17 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask, request, jsonify, render_template
# create the flask app
app = Flask(__name__)
# what html should be loaded as the home page when the app loads?
@app.route('/')
def home():
return render_template('app_frontend.html', prediction_text="")
# define the logic for reading the inputs from the WEB PAGE,
# running the model, and displaying the prediction
@app.route('/predict', methods=['GET','POST'])
def predict():
# get the description submitted on the web page
a_description = request.form.get('description')
return render_template('app_frontend.html', prediction_text=a_description)
# boilerplate flask app code
if __name__ == "__main__":
app.run(debug=True)