-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
59 lines (46 loc) · 1.58 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from flask import Flask, render_template,request
import pickle;
app = Flask(__name__)
file=open('predictor.pkl','rb');
classifier=pickle.load(file);
file.close()
@app.route("/",methods=["GET","POST"])
def hello():
print("request.method",request.method)
if request.method=="POST":
#print(request.form)
mydict=request.form
age=int(mydict['age']);
sex=int(mydict['sex']);
cp=int(mydict['cp']);
trestbps=int(mydict['trestbps']);
chol=int(mydict['chol']);
fbs=int(mydict['fbs']);
restecg=int(mydict['restecg']);
thalach=int(mydict['thalach']);
exang=int(mydict['exang']);
oldpeak=float(mydict['oldpeak']);
slope=int(mydict['slope']);
ca=int(mydict['ca']);
thal=int(mydict['thal']);
user_input=[age,sex,cp,trestbps,chol,fbs,restecg,thalach,exang,oldpeak,slope,ca,thal]
prob=classifier.predict_proba([user_input])[0][1]
print("prob=",prob)
return render_template('show1.html',p=prob*100)
return render_template('index1.html')
@app.route("/contact",methods=["GET","POST"])
def contact():
if request.method=="GET":
return render_template('contact.html')
return render_template('index1.html')
@app.route("/about",methods=["GET","POST"])
def about():
if request.method=="GET":
return render_template('about.html')
return render_template('index1.html')
@app.route("/home",methods=["GET","POST"])
def home():
return render_template('index1.html')
if "__name__"=="__main__":
pass
app.run(debug=True)