Spaces:
Sleeping
Sleeping
File size: 1,740 Bytes
dba74a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
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.cache
def fetch_data():
df = pd.read_csv('https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/campus.csv')
return df
df = fetch_data()
def user_input():
gender = st.selectbox('Gender', df['gender'].unique())
ssc = st.number_input('Secondary School Points', value=67.00)
hsc = st.number_input('High School Points', 0.0, value=91.0)
hsc_s = st.selectbox('High School Spec', df['hsc_s'].unique())
degree_p = st.number_input('Degree Points', 0.0, value=58.0)
degree_t = st.selectbox('Degree Spec', df['degree_t'].unique())
workex = st.selectbox('Work Experience?', df['workex'].unique())
etest_p = st.number_input('Etest Points', 0.0, value=78.00)
spec = st.selectbox('Specialization', df['specialisation'].unique())
mba_p = st.number_input('MBA Points', 0.0, value=54.55)
data = {
'gender': gender,
'ssc_p': ssc,
'hsc_p': hsc,
'hsc_s': hsc_s,
'degree_p': degree_p,
'degree_t': degree_t,
'workex': workex,
'etest_p': etest_p,
'specialisation':spec,
'mba_p': mba_p
}
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 = 'Placed'
else:
prediction = 'Not Placed'
st.write('Based on user input, the placement model predicted: ')
st.write(prediction) |