Spaces:
Runtime error
Runtime error
Commit ·
20112cd
1
Parent(s): 893765a
Upload 4 files
Browse files- app.py +45 -0
- list_cat_cols.txt +0 -0
- list_num_cols.txt +0 -0
- model_scaler.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
import joblib
|
| 5 |
+
|
| 6 |
+
with open('model_rf_model.pkl', 'rb') as file_1:
|
| 7 |
+
model_rf_model= joblib.load(file_1)
|
| 8 |
+
|
| 9 |
+
with open('model_scaler.pkl', 'rb') as file_2:
|
| 10 |
+
model_scaler=joblib.load(file_2)
|
| 11 |
+
|
| 12 |
+
with open('list_num_cols.txt', 'rb') as file_4:
|
| 13 |
+
num_cols= joblib.load(file_4)
|
| 14 |
+
|
| 15 |
+
with open('list_cat_cols.txt', 'rb') as file_5:
|
| 16 |
+
cat_cols= joblib.load(file_5)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
age = st.slider('Masukan Umur:',0, 42, step=1)
|
| 20 |
+
creatinine_phosphokinase = st.number_input('Masukan total creatinine phosphokinase :')
|
| 21 |
+
anaemia = st.radio('Apakah anda mengidap Anaemia? 1=ya, 0=tidak',(0, 1))
|
| 22 |
+
serum_creatinine = st.slider('Masukan Serum Creatinine:',0.0, 10.0)
|
| 23 |
+
high_blood_pressure = st.radio('Apakah anda mengidap Hipertensi? 1=ya, 0=tidak',(0, 1))
|
| 24 |
+
smoking = st.radio('Apakah anda merokok? 1=ya, 0=tidak',(0, 1))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
if st.button('Predict'):
|
| 28 |
+
|
| 29 |
+
data_inf = pd.DataFrame({
|
| 30 |
+
'age': age,
|
| 31 |
+
'creatinine_phosphokinase': creatinine_phosphokinase,
|
| 32 |
+
'anaemia': anaemia,
|
| 33 |
+
'serum_creatinine':serum_creatinine,
|
| 34 |
+
'high_blood_pressure': high_blood_pressure,
|
| 35 |
+
'smoking':smoking },index=0)
|
| 36 |
+
data_inf
|
| 37 |
+
# data_inf_scaled = model_scaler.transform(data_inf[num_cols])
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# data_inf_fix = np.concatenate([data_inf_scaled, data_inf[cat_cols]], axis=1)
|
| 41 |
+
# hasil = model_rf_model.predict(data_inf_fix)
|
| 42 |
+
# st.header(f'Death Event= ${hasil}')
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
list_cat_cols.txt
ADDED
|
Binary file (77 Bytes). View file
|
|
|
list_num_cols.txt
ADDED
|
Binary file (49 Bytes). View file
|
|
|
model_scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ef218bba754492ee0865ee6b28f800a21430cc55f437a018c7053df98f351bb
|
| 3 |
+
size 999
|