sihar commited on
Commit
cd15c51
1 Parent(s): 42a7869

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +45 -0
  2. rf_randomCV.pkl +3 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import seaborn as sns
4
+
5
+ #title
6
+ st.title("Predict Death Event")
7
+ st.write("Created by Sihar Pangaribuan")
8
+
9
+ # User imput
10
+ age = st.number_input(label='Age', min_value=40, max_value=95, value=40, step=1)
11
+ anaemia = st.selectbox(label='Anemia', options=['0', '1'])
12
+ creatinine_phosphokinase = st.number_input(label='Creatinine Phosphokinase', min_value=23, max_value=7861, value=23, step=1)
13
+ diabetes = st.selectbox(label='Diabetes', options=['0', '1'])
14
+ ejection_fraction = st.number_input(label='Ejection Fraction', min_value=14, max_value=80, value=14, step=1)
15
+ high_blood_pressure = st.selectbox(label='High Blood Pressure', options=['0', '1'])
16
+ platelets = st.number_input(label='Platelets', min_value=25100.0, max_value=850000.0, value=25100.0, step=1.0)
17
+ serum_creatinine = st.number_input(label='Serum Creatinine', min_value=0.5, max_value=9.4, value=0.5, step=0.1)
18
+ serum_sodium = st.number_input(label='Serum Sodium', min_value=133, max_value=148, value=133, step=1)
19
+ sex = st.selectbox(label='Sex', options=['0', '1'])
20
+ smoking = st.selectbox(label='Smoking', options=['0', '1'])
21
+ time = st.number_input(label='Time', min_value=4, max_value=285, value=4, step=1)
22
+
23
+ # Convert ke data frame
24
+ data = pd.DataFrame({'age': [age],
25
+ 'anemia': [anaemia],
26
+ 'creatinine_phosphokinase': [creatinine_phosphokinase],
27
+ 'diabetes':[diabetes],
28
+ 'ejection_fraction': [ejection_fraction],
29
+ 'high_blood_pressure': [high_blood_pressure],
30
+ 'platelets': [platelets],
31
+ 'serum_creatinine': [serum_creatinine],
32
+ 'serum_sodium': [serum_sodium],
33
+ 'sex': [sex],
34
+ 'smoking': [smoking],
35
+ 'time': [time]})
36
+
37
+ # model predict
38
+ death = rf_randomCV.predict(data).tolist()[0]
39
+
40
+ # interpretation
41
+ st.write('Predition Result: ')
42
+ if death == 0:
43
+ st.text('live')
44
+ else:
45
+ st.text('Death')
rf_randomCV.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44106088e43f386a95d665d35912a6fda7fbf1a7594b529e3cda4181c007ce5a
3
+ size 396701