-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
36 lines (30 loc) · 1.08 KB
/
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
from flask import Flask,render_template,request
import numpy as np
import pickle
import pandas as pd
app=Flask(__name__)
@app.route('/')
def home():
return render_template('input.html')
def valpredict(to_predict_list):
to_predict=np.array(to_predict_list).reshape(1,10)
loaded_model=pickle.load(open('E:/python/web_flask/Stroke_pickle.pkl','rb'))
result=loaded_model.predict(to_predict)
return result[0]
@app.route('/result',methods=["POST"])
def result():
if request.method=="POST":
to_predict_list=request.form
print(to_predict_list)
to_predict_list=list(to_predict_list.values())
to_predict_list=list(map(int,to_predict_list))
print(to_predict_list)
result=valpredict(to_predict_list)
if int(result)==1:
prediction="The person might get stroke"
else:
prediction="The person is stroke free"
return render_template("result.html",prediction=prediction)
if __name__=="__main__":
app.run(debug=True)
app.config["TEMPLATES_AND_RELOAD"]==True