GS123 commited on
Commit
c6cc915
·
1 Parent(s): de4f697

Upload 5 files

Browse files
Files changed (5) hide show
  1. app.py +51 -0
  2. model.pkl +3 -0
  3. notok.jpg +0 -0
  4. ok.jpg +0 -0
  5. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ from PIL import Image
4
+
5
+
6
+ ok = Image.open('ok.jpg')
7
+ not_ok = Image.open("notok.jpg")
8
+
9
+
10
+ st.write ('''
11
+
12
+ ## Heart Health Predictor
13
+ ''')
14
+
15
+ age = st.number_input('Enter your age', min_value= 0, max_value= 100, step = 1)
16
+
17
+ gender = st.selectbox(
18
+ 'Gender',
19
+ ('Male', 'Female'))
20
+
21
+ if gender == "Male":
22
+ gender_value = 1
23
+ else:
24
+ gender_value = 0
25
+
26
+ bp = st.number_input('Enter your BP', value= 120, step = 1)
27
+ cholestrol = st.number_input('Enter your Cholestrol', value= 100, step = 1)
28
+
29
+
30
+ data = [[age, gender_value, bp, cholestrol]]
31
+
32
+ #load models
33
+ # @st.cache_data(allow_output_mutation = True)
34
+ def cache_model(path):
35
+ model = pickle.load(open(path, 'rb'))
36
+ return (model)
37
+
38
+ heart_model = cache_model("model.pkl")
39
+
40
+ if st.button('Predict'):
41
+ result = heart_model.predict(data)
42
+ if result == 1:
43
+ st.image(not_ok)
44
+ st.write("## Please visit a cardiologist")
45
+
46
+ else:
47
+ st.image(ok)
48
+ st.write("## Great!, You are at no risk")
49
+
50
+
51
+
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0be10a1f4ee28e9dd105b9b2614e5780717958e8b11b375f79619b447bc343c2
3
+ size 321712
notok.jpg ADDED
ok.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit == 1.21.0
2
+ Pillow == 9.5.0
3
+ scikit-learn == 1.2.2