-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (24 loc) · 917 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
#inporting relevant libraries
import numpy as np
import pickle
from flask import Flask, request, render_template
import numpy.random._pickle
app = Flask(__name__,template_folder='templates/')
model = pickle.load(open('model(gb).pkl','rb'))
@app.route('/')
def heart():
return render_template('outline.html')
@app.route('/predict',methods=['GET','POST'])
def predict():
if request.method == "GET":
return render_template('Heart.html')
features = [float(i) for i in request.form.values()]
array_features = [np.array(features)]
prediction = model.predict(array_features)
output = prediction
if output == 1:
return render_template('Heart.html', result = 'The patient is not likely to have heart disease!')
else:
return render_template('Heart.html',result='The patient is likely to have heart disease!')
if __name__ == '__main__':
app.run(debug=True)