import streamlit as st import pandas as pd import joblib st.header('FTDS Model Deployment') st.write(""" Created by FTDS Curriculum Team Use the sidebar to select input features. """) st.sidebar.header('User Input Features') def user_input(): limit_balance = st.sidebar.selectbox('limit_balance', [ 80000., 200000., 20000., 260000., 150000., 300000., 130000., 500000., 230000., 460000., 780000., 170000., 320000., 290000., 240000., 340000., 360000., 380000., 180000., 100000., 90000., 50000., 160000., 70000., 280000., 220000., 30000., 120000., 10000., 470000., 310000., 140000., 60000., 110000., 430000., 210000., 490000., 330000., 250000., 400000., 370000., 440000., 700000., 530000., 390000., 410000., 270000., 560000., 40000., 680000., 480000., 190000., 350000., 420000., 510000., 800000., 450000., 750000., 620000.]) pay_1 = st.sidebar.slider('pay_1', min_value=-12, max_value=12) pay_2 = st.sidebar.slider('pay_2', min_value=-12, max_value=12) pay_3 = st.sidebar.slider('pay_3', min_value=-12, max_value=12) pay_4 = st.sidebar.slider('pay_4', min_value=-12, max_value=12) pay_5 = st.sidebar.slider('pay_5', min_value=-12, max_value=12) pay_6 = st.sidebar.slider('pay_6', min_value=-12, max_value=12) data = { 'limit_balance': limit_balance, 'pay_0': pay_1, 'pay_2': pay_2, 'pay_3': pay_3, 'pay_4': pay_4, 'pay_5': pay_5, 'pay_6': pay_6 } features = pd.DataFrame(data, index=[0]) return features input = user_input() st.subheader('User Input') st.write(input) load_model = joblib.load("my_model.pkl") if st.button("Predict"): prediction = load_model.predict(input) if prediction == 1: prediction = 'Defaulted Payment' else: prediction = 'Not Defaulted' st.subheader('Based on user input, the placement model predicted: ') st.header(prediction)