-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
34 lines (26 loc) · 860 Bytes
/
app.py
File metadata and controls
34 lines (26 loc) · 860 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
32
33
34
# Importing the liberaries
import pickle
import numpy as np
from flask import Flask , request , render_template
#Global Variable
app = Flask(__name__)
loadModel = pickle.load(open('diabetes.pkl','rb'))
#User defined functions
@app.route("/",methods = ['GET'])
def Home():
return render_template('index.html')
@app.route('/prediction',methods = ['POST'])
def predict():
name = request.form['name']
age = int(request.form['age'])
bmi = int(request.form['BMI'])
glucose = int(request.form['Glucose'])
prediction = loadModel.predict([[glucose,bmi,age]])
if prediction == [0]:
prediction = 'Not Diabetic'
else :
prediction = 'Diabetic'
return render_template('index.html',diagnosis_output = prediction)
# Main Function
if __name__ == "__main__":
app.run(debug = True)