WatchaH commited on
Commit
006453c
1 Parent(s): 95081d8

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +62 -0
  2. model (1).joblib +3 -0
  3. requirements.txt +5 -0
  4. unique_values (1).joblib +3 -0
app.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+ ANAE_DIC = {'NO': 0, 'YES': 1}
6
+ DIA_DIC = {'NO': 0, 'YES': 1}
7
+ HIGHBLOOD_DIC = {'NO': 0, 'YES': 1}
8
+ SMOKE_DIC = {'NO': 0, 'YES': 1}
9
+ DEATH_DIC = {'NO': 0, 'YES': 1}
10
+
11
+ model = joblib.load('model (1).joblib')
12
+ unique_values = joblib.load('unique_values (1).joblib')
13
+
14
+ unique_age = unique_values["age"]
15
+ unique_anaemia = unique_values["anaemia"]
16
+ unique_creatinine = unique_values["creatinine_phosphokinase"]
17
+ unique_diabetes = unique_values["diabetes"]
18
+ unique_ejection = unique_values["ejection_fraction"]
19
+ unique_high_blood = unique_values["high_blood_pressure"]
20
+ unique_platelets = unique_values["platelets"]
21
+ unique_serum_creatinine = unique_values["serum_creatinine"]
22
+ unique_serum_sodium = unique_values["serum_sodium"]
23
+ unique_sex = unique_values["sex"]
24
+ unique_smoking = unique_values["smoking"]
25
+ unique_time = unique_values["time"]
26
+
27
+ def main():
28
+ st.title("Adult Income Analysis")
29
+
30
+ with st.form("questionaire"):
31
+ age = st.slider("Age", min_value=10, max_value=100)
32
+ anaemia = st.selectbox("Anaemia", unique_anaemia)
33
+ creatinine = st.slider("Creatinine", min_value=10, max_value=10000)
34
+ diabetes = st.selectbox("Diabetes", unique_diabetes)
35
+ ejection = st.slider("Ejection(Percent)", min_value=1, max_value=100)
36
+ high_blood = st.selectbox("High blood pressure", unique_high_blood)
37
+ platelets = st.slider("Platelets", min_value=10000, max_value=1000000)
38
+ serum_creatinine = st.slider("Serum creatinine", min_value=0, max_value=10)
39
+ sodium = st.slider("Serum Sodium", min_value=100, max_value=200)
40
+ sex = st.selectbox("Sex", unique_sex)
41
+ smoking = st.selectbox("Smoke", unique_smoking)
42
+ time = st.slider("Time", min_value=10, max_value=100)
43
+
44
+ clicked = st.form_submit_button("Predict income")
45
+ if clicked:
46
+ result=model.predict(pd.DataFrame({"age": [age],
47
+ "anaemia": [ANAE_DIC[anaemia]],
48
+ "creatinine": [creatinine],
49
+ "diabetes": [DIA_DIC[diabetes]],
50
+ "ejection": [ejection],
51
+ "high_blood": [HIGHBLOOD_DIC[high_blood]],
52
+ "platelets": [platelets],
53
+ "serum_creatinine": [serum_creatinine],
54
+ "serum_sodium": [sodium],
55
+ "sex": [sex],
56
+ "smoking": [SMOKE_DIC[smoking]],
57
+ "time": [time]}))
58
+ result = 'No' if result[0] == 1 else 'Yes'
59
+ st.success('The predicted Death event is {}'.format(result))
60
+
61
+ if __name__=='__main__':
62
+ main()
model (1).joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26bca3537397b211972d4d035852111c6eb103e05e7a8eae7d3125dd016c8899
3
+ size 126025
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5
unique_values (1).joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48cb7c8db3b026991810ab071fd1bce2acbe3bc66d4c527696061eb48003570a
3
+ size 544