Spaces:
Sleeping
Sleeping
upload all files
Browse files- app.py +65 -0
- model.pkl +3 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
def fetch_data():
|
14 |
+
df = pd.read_csv('https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/campus.csv')
|
15 |
+
return df
|
16 |
+
|
17 |
+
df = fetch_data()
|
18 |
+
st.write(df)
|
19 |
+
|
20 |
+
st.sidebar.header('User Input Features')
|
21 |
+
|
22 |
+
def user_input():
|
23 |
+
gender = st.sidebar.selectbox('Gender', df['gender'].unique())
|
24 |
+
ssc = st.sidebar.number_input('Secondary School Points', value=67.00)
|
25 |
+
hsc = st.sidebar.number_input('High School Points', 0.0, value=91.0)
|
26 |
+
hsc_s = st.sidebar.selectbox('High School Spec', df['hsc_s'].unique())
|
27 |
+
degree_p = st.sidebar.number_input('Degree Points', 0.0, value=58.0)
|
28 |
+
degree_t = st.sidebar.selectbox('Degree Spec', df['degree_t'].unique())
|
29 |
+
workex = st.sidebar.selectbox('Work Experience?', df['workex'].unique())
|
30 |
+
etest_p = st.sidebar.number_input('Etest Points', 0.0, value=78.00)
|
31 |
+
spec = st.sidebar.selectbox('Specialization', df['specialisation'].unique())
|
32 |
+
mba_p = st.sidebar.number_input('MBA Points', 0.0, value=54.55)
|
33 |
+
|
34 |
+
data = {
|
35 |
+
'gender': gender,
|
36 |
+
'ssc_p': ssc,
|
37 |
+
'hsc_p': hsc,
|
38 |
+
'hsc_s': hsc_s,
|
39 |
+
'degree_p': degree_p,
|
40 |
+
'degree_t': degree_t,
|
41 |
+
'workex': workex,
|
42 |
+
'etest_p': etest_p,
|
43 |
+
'specialisation':spec,
|
44 |
+
'mba_p': mba_p
|
45 |
+
}
|
46 |
+
features = pd.DataFrame(data, index=[0])
|
47 |
+
return features
|
48 |
+
|
49 |
+
|
50 |
+
input = user_input()
|
51 |
+
|
52 |
+
st.subheader('User Input')
|
53 |
+
st.write(input)
|
54 |
+
|
55 |
+
load_model = joblib.load("model.pkl")
|
56 |
+
|
57 |
+
prediction = load_model.predict(input)
|
58 |
+
|
59 |
+
if prediction == 1:
|
60 |
+
prediction = 'Placed'
|
61 |
+
else:
|
62 |
+
prediction = 'Not Placed'
|
63 |
+
|
64 |
+
st.write('Based on user input, the placement model predicted: ')
|
65 |
+
st.write(prediction)
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d3d0f3c40b5e5cc330ba3135936bd72694c2b724968c3725cdd859d9ae0d51b2
|
3 |
+
size 6131
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
sklearn-learn == 1.3.0
|
2 |
+
pandas
|
3 |
+
matplotlib
|
4 |
+
joblib
|