import streamlit as st import pandas as pd import pickle def run(): # Load All Files with open('pipeline_model.pkl', 'rb') as file: full_process = pickle.load(file) file_path = "/Users/ryantrisnadi/Desktop/first_project1/p1-ftds017-hck-g5-ryantrisnadi/_P1G5_Set_1_Ryan_Trisnadi.csv" df_original = pd.read_csv(file_path) index_columns = ['limit_balance', 'sex', 'education_level', 'marital_status', 'age', 'pay_0', 'pay_2', 'pay_3', 'pay_4', 'pay_5', 'pay_6', 'bill_amt_1', 'bill_amt_2', 'bill_amt_3', 'bill_amt_4', 'bill_amt_5', 'bill_amt_6', 'pay_amt_1', 'pay_amt_2', 'pay_amt_3', 'pay_amt_4', 'pay_amt_5', 'pay_amt_6', 'default_payment_next_month'] df_data_dummy = df_original[index_columns].copy() st.write('In the following is the result of the data you have input : ') print(df_data_dummy.head()) st.table(df_data_dummy) if st.button(label='predict'): # Melakukan prediksi data dummy y_pred_inf = full_process.predict(df_data_dummy) st.write('Client kemungkinan gagal bayar utang') st.metric(label="Here is a prediction: ", value = y_pred_inf[0]) # If your data is a classification, you can follow the example below # if y_pred_inf[0] == 0: # st.write('Pasien tidak terkena jantung') # st.markdown("[Cara Cegah Serangan Jantung](https://www.siloamhospitals.com/informasi-siloam/artikel/cara-cegah-serangan-jantung-di-usia-muda)") # else: # st.write('Pasien kemungkinan terkena jantung') # st.markdown("[Cara Hidup Sehat Sehabis Terkena Serangan Jantung](https://lifestyle.kompas.com/read/2021/11/09/101744620/7-pola-hidup-sehat-setelah-mengalami-serangan-jantung?page=all)")