Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +62 -0
- my_model.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
st.header('FTDS Model Deployment')
|
| 6 |
+
st.write("""
|
| 7 |
+
Created by FTDS Curriculum Team
|
| 8 |
+
|
| 9 |
+
Use the sidebar to select input features.
|
| 10 |
+
""")
|
| 11 |
+
|
| 12 |
+
@st.cache
|
| 13 |
+
|
| 14 |
+
df = pd.read_csv('https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/campus.csv')
|
| 15 |
+
|
| 16 |
+
df = fetch_data()
|
| 17 |
+
|
| 18 |
+
def user_input():
|
| 19 |
+
gender = st.selectbox('Gender', df['gender'].unique())
|
| 20 |
+
ssc = st.number_input('Secondary School Points', value=67.00)
|
| 21 |
+
hsc = st.number_input('High School Points', 0.0, value=91.0)
|
| 22 |
+
hsc_s = st.selectbox('High School Spec', df['hsc_s'].unique())
|
| 23 |
+
degree_p = st.number_input('Degree Points', 0.0, value=58.0)
|
| 24 |
+
degree_t = st.selectbox('Degree Spec', df['degree_t'].unique())
|
| 25 |
+
workex = st.selectbox('Work Experience?', df['workex'].unique())
|
| 26 |
+
etest_p = st.number_input('Etest Points', 0.0, value=78.00)
|
| 27 |
+
spec = st.selectbox('Specialization', df['specialisation'].unique())
|
| 28 |
+
mba_p = st.number_input('MBA Points', 0.0, value=54.55)
|
| 29 |
+
|
| 30 |
+
data = {
|
| 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_p
|
| 41 |
+
}
|
| 42 |
+
features = pd.DataFrame(data, index=[0])
|
| 43 |
+
return features
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
input = user_input()
|
| 47 |
+
|
| 48 |
+
st.subheader('User Input')
|
| 49 |
+
st.write(input)
|
| 50 |
+
|
| 51 |
+
load_model = joblib.load("my_model.pkl")
|
| 52 |
+
|
| 53 |
+
if st.button('Predict'):
|
| 54 |
+
prediction = load_model.predict(input)
|
| 55 |
+
|
| 56 |
+
if prediction == 1:
|
| 57 |
+
prediction = 'Placed'
|
| 58 |
+
else:
|
| 59 |
+
prediction = 'Not Placed'
|
| 60 |
+
|
| 61 |
+
st.write('Based on user input, the placement model predicted: ')
|
| 62 |
+
st.write(prediction)
|
my_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:044c3279b2bda005ba401e82d9a8b90b9b677f1d5585406c45f962399e36e892
|
| 3 |
+
size 6115
|