Spaces:
Sleeping
Sleeping
import streamlit as st | |
import pandas as pd | |
import pickle | |
import joblib | |
st.title("Prediction of Death Event") | |
# import model | |
model = pickle.load(open("boosted.pkl", "rb")) | |
st.write('Insert feature below to predict') | |
# user input | |
age = st.number_input(label='Age', min_value=40, max_value=95, value=40, step=1) | |
anaemia = st.selectbox(label='Anaemia', options=[0,1]) | |
creatinine_phosphokinase = st.number_input(label='Creatinine Phosphokinase', min_value=23.0, max_value=1954.5, value=23.0, step=0.1) | |
diabetes = st.selectbox(label='Diabetes', options=[0,1]) | |
ejection_fraction = st.number_input(label='Ejection Fraction', min_value=14.0, max_value=73.4, value=14.0, step=0.1) | |
high_blood_pressure = st.selectbox(label='High Blood Pressure', options=[0,1]) | |
platelets = st.number_input(label='Platelets', min_value=25100, max_value=543000, value=26000, step=10) | |
serum_creatinine = st.number_input(label='Serum Creatinine', min_value=0.5, max_value=4.2, value=1.5, step=0.1) | |
smoking = st.selectbox(label='Smoking', options=[0,1]) | |
time = st.number_input(label='Time', min_value=4, max_value=285, value=10, step=1) | |
# convert into dataframe | |
data = pd.DataFrame({'Age': [age], | |
'Anaemia': [anaemia], | |
'Creatinine Phosphokinas': [creatinine_phosphokinase], | |
'Diabetes':[diabetes], | |
'Ejection Fraction': [ejection_fraction], | |
'High Blood Pressure': [high_blood_pressure], | |
'Platelets': [platelets], | |
'Serum Creatinine': [serum_creatinine], | |
'Smoking': [smoking], | |
'Time': [time]}) | |
# model predict | |
clas = model.predict(data).tolist()[0] | |
# interpretation | |
st.write('Classification Result: ') | |
if clas == 1: | |
st.text('Die') | |
else: | |
st.text('Alive') |