The-Adnan-Syed commited on
Commit
4c81425
1 Parent(s): 2e3b0da

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +65 -0
  2. heart_model.h5 +3 -0
app.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import joblib
4
+
5
+ st.title("Heart Disease Prediction")
6
+
7
+ gender = st.radio("Select Your Gender",['Male','Female'])
8
+
9
+ if gender=="Male":
10
+ gender=1
11
+ else:
12
+ gender=0
13
+
14
+ age = st.slider("Select Your Age")
15
+
16
+ cigsPerDay = st.number_input("Enter No.of Ciggarettes Per Day")
17
+
18
+ BPMeds = st.radio("Do you take BP Medicines?",["True","False"])
19
+
20
+ if BPMeds=="True":
21
+ BPMeds=1.0
22
+ else:
23
+ BPMeds=0.0
24
+
25
+ prevStroke = st.radio("Do you have any prevalent stroke?",["True","False"])
26
+
27
+
28
+ if prevStroke=="True":
29
+ prevStroke=1
30
+ else:
31
+ prevStroke=0
32
+
33
+ prevalentHyp = st.radio("Do you have any prevalent hypertension?",["True","False"])
34
+
35
+ if prevalentHyp=="True":
36
+ prevalentHyp=1
37
+ else:
38
+ prevalentHyp=0
39
+
40
+ diabetes = st.radio("Do you have diabetes?",["True","False"])
41
+
42
+ if diabetes=="True":
43
+ diabetes=1
44
+ else:
45
+ diabetes=0
46
+
47
+ totChol = st.number_input("Enter your cholestrol level")
48
+
49
+ sysBP = st.number_input("Enter your systole blood pressure level")
50
+
51
+ diaBP = st.number_input("Enter your diastole blood pressure level")
52
+
53
+ bmi = st.number_input("Enter your BMI")
54
+
55
+ heart_rate = st.number_input("Enter your heart beats per minute.")
56
+
57
+ if st.button("Predict"):
58
+ model = joblib.load("heart_model.h5")
59
+ prediction = model.predict([[gender,age,cigsPerDay,BPMeds,prevStroke,prevalentHyp,diabetes,totChol,sysBP,diaBP,bmi,heart_rate]])
60
+ if prediction[0] == 0:
61
+ prediction = "You are not at a risk of getting a heart disease."
62
+ st.success(prediction)
63
+ else:
64
+ prediction = "You are at risk of getting a heart disease."
65
+ st.success(prediction)
heart_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a27d7d7e42ffe3223d8afbd58b1ab5e4f293bdcc227262223ac409621271c40
3
+ size 1344