galihsukmana commited on
Commit
15cf699
1 Parent(s): 02fb6d5

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +48 -0
  2. boosted.pkl +3 -0
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import pickle
4
+ import joblib
5
+
6
+ st.title("Prediction of Death Event")
7
+
8
+ # import model
9
+ model = pickle.load(open("boosted.pkl", "rb"))
10
+
11
+
12
+
13
+ st.write('Insert feature below to predict')
14
+
15
+ # user input
16
+ age = st.number_input(label='Age', min_value=40, max_value=95, value=40, step=1)
17
+ anaemia = st.selectbox(label='Anaemia', options=[0,1])
18
+ creatinine_phosphokinase = st.number_input(label='Creatinine Phosphokinase', min_value=23.0, max_value=1954.5, value=23.0, step=0.1)
19
+ diabetes = st.selectbox(label='Diabetes', options=[0,1])
20
+ ejection_fraction = st.number_input(label='Ejection Fraction', min_value=14.0, max_value=73.4, value=14.0, step=0.1)
21
+ high_blood_pressure = st.selectbox(label='High Blood Pressure', options=[0,1])
22
+ platelets = st.number_input(label='Platelets', min_value=25100, max_value=543000, value=26000, step=10)
23
+ serum_creatinine = st.number_input(label='Serum Creatinine', min_value=0.5, max_value=4.2, value=1.5, step=0.1)
24
+ smoking = st.selectbox(label='Smoking', options=[0,1])
25
+ time = st.number_input(label='Time', min_value=4, max_value=285, value=10, step=1)
26
+
27
+ # convert into dataframe
28
+ data = pd.DataFrame({'Age': [age],
29
+ 'Anaemia': [anaemia],
30
+ 'Creatinine Phosphokinas': [creatinine_phosphokinase],
31
+ 'Diabetes':[diabetes],
32
+ 'Ejection Fraction': [ejection_fraction],
33
+ 'High Blood Pressure': [high_blood_pressure],
34
+ 'Platelets': [platelets],
35
+ 'Serum Creatinine': [serum_creatinine],
36
+ 'Smoking': [smoking],
37
+ 'Time': [time]})
38
+
39
+ # model predict
40
+
41
+ clas = model.predict(data).tolist()[0]
42
+
43
+ # interpretation
44
+ st.write('Classification Result: ')
45
+ if clas == 1:
46
+ st.text('Die')
47
+ else:
48
+ st.text('Alive')
boosted.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c6e13bdf4dec37d6f4424f1f0f9688c8d813ca28d2fbd5b5b356a6d4a5637ab
3
+ size 3693246