AlselloDM/Training
0
1import streamlit as st2import pandas as pd3import joblib4 5st.header('FTDS Model Deployment')6st.write("""7Created by FTDS Student Alsello8 9Use the sidebar to select input features.10""")11 12@st.cache13def fetch_data():14 df = pd.read_csv('https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/campus.csv')15 return df16 17df = fetch_data()18 19gender = st.selectbox('Jenis Kelamin', df['gender'].unique())20ssc = st.number_input('NEM SMP', value=67.00)21hsc = st.number_input('NEM SMA', 0.0, value=91.0)22hsc_s = st.selectbox('Penjurusan SMA', df['hsc_s'].unique())23degree_p = st.number_input('Nilai Kuliah', 0.0, value=58.0)24degree_t = st.selectbox('Jurusan Kuliah', df['degree_t'].unique())25workex = st.selectbox('Pengalaman Bekerja', df['workex'].unique())26etest_p = st.number_input('Poin Tes Online', 0.0, value=78.00)27spec = st.selectbox('Spesialisasi', df['specialisation'].unique())28mba_p = st.number_input('Poin MBA', 0.0, value=54.55)29 30data = {31 'gender': gender,32 'ssc_p': ssc,33 'hsc_p': hsc,34 'hsc_s': hsc_s,35 'degree_p': degree_p,36 'degree_t': degree_t,37 'workex': workex,38 'etest_p': etest_p,39 'specialisation':spec,40 'mba_p': mba_p41}42input = pd.DataFrame(data, index=[0])43 44st.subheader('User Input')45st.write(input)46 47load_model = joblib.load("my_model.pkl")48 49if st.button('Predict'):50 prediction = load_model.predict(input)51 52 if prediction == 1:53 prediction = 'Placed'54 else:55 prediction = 'Not Placed'56 57 st.write('Based on user input, the placement model predicted: ')58 st.write(prediction)