-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (21 loc) · 737 Bytes
/
app.py
File metadata and controls
27 lines (21 loc) · 737 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
from flask import Flask, render_template,request
import pickle
from sklearn.linear_model import LogisticRegression
app = Flask(__name__)
with open ('models/model.pkl','rb') as f:
model = pickle.load(f)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods = ['POST'])
def predict():
if request.method == 'POST':
spl = float(request.form['spl'])
spw = float(request.form['spw'])
ptl = float(request.form['ptl'])
ptw = float(request.form['ptw'])
data = [[spl, spw, ptl, ptw]]
prediction = model.predict(data)[0]
return render_template('index.html', prediction = prediction)
if __name__ == "__main__":
app.run(debug = True)