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