-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
37 lines (24 loc) · 965 Bytes
/
app.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
from flask import Flask, render_template, request
import pickle
import numpy as np
clf = pickle.load(open('model.pkl', 'rb'))
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
preg = int(request.form['pregnancies'])
glucose = int(request.form['glucose'])
bp = int(request.form['bloodpressure'])
st = int(request.form['skinthickness'])
insulin = int(request.form['insulin'])
bmi = float(request.form['bmi'])
dpf = float(request.form['dpf'])
age = int(request.form['age'])
data = np.array([[preg, glucose, bp, st, insulin, bmi, dpf, age]])
my_prediction = clf.predict(data)
return render_template('output.html', prediction=my_prediction)
if __name__ == '__main__':
app.run(debug=True)