-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (23 loc) · 947 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (23 loc) · 947 Bytes
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
import flask
from flask import request, render_template
import joblib
app = flask.Flask(__name__, static_url_path='')
@app.route('/', methods=['GET'])
def sendHomePage():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predictPerformance():
cylinders = float(request.form['cylinders'])
displacement = float(request.form['displacement'])
horsepower = float(request.form['horsepower'])
weight = float(request.form['weight'])
acceleration = float(request.form['acceleration'])
modelyear = float(request.form['modelyear'])
origin = float(request.form['origin'])
X = [[cylinders,displacement,horsepower,
weight,acceleration,modelyear,origin]]
model = joblib.load('gbr_performance.pkl')
rating = model.predict(X)[0]
return render_template('predict.html',predict=round(rating))
if __name__ == '__main__':
app.run()