AnonAnonymous commited on
Commit
970bc1d
1 Parent(s): d678335
Files changed (1) hide show
  1. app.py +63 -2
app.py CHANGED
@@ -1,4 +1,65 @@
1
  import streamlit as st
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Use the sidebar to select input features.
9
+ """)
10
+
11
+ @st.cache
12
+ def fetch_data():
13
+ df = pd.read_csv('https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/campus.csv')
14
+ return df
15
+
16
+ df = fetch_data()
17
+ st.write(df)
18
+
19
+ st.sidebar.header('User Input Features')
20
+
21
+ def user_input():
22
+ gender = st.sidebar.selectbox('Gender', df['gender'].unique())
23
+ ssc = st.sidebar.number_input('Secondary School Points', value=67.00)
24
+ hsc = st.sidebar.number_input('High School Points', 0.0, value=91.0)
25
+ hsc_s = st.sidebar.selectbox('High School Spec', df['hsc_s'].unique())
26
+ degree_p = st.sidebar.number_input('Degree Points', 0.0, value=58.0)
27
+ degree_t = st.sidebar.selectbox('Degree Spec', df['degree_t'].unique())
28
+ workex = st.sidebar.selectbox('Work Experience?', df['workex'].unique())
29
+ etest_p = st.sidebar.number_input('Etest Points', 0.0, value=78.00)
30
+ spec = st.sidebar.selectbox('Specialization', df['specialisation'].unique())
31
+ mba_p = st.sidebar.number_input('MBA Points', 0.0, value=54.55)
32
+
33
+ data = {
34
+ 'gender': gender,
35
+ 'ssc_p': ssc,
36
+ 'hsc_p': hsc,
37
+ 'hsc_s': hsc_s,
38
+ 'degree_p': degree_p,
39
+ 'degree_t': degree_t,
40
+ 'workex': workex,
41
+ 'etest_p': etest_p,
42
+ 'specialisation':spec,
43
+ 'mba_p': mba_p
44
+ }
45
+ features = pd.DataFrame(data, index=[0])
46
+ return features
47
+
48
+
49
+ input = user_input()
50
+
51
+ st.subheader('User Input')
52
+ st.write(input)
53
+
54
+ load_model = joblib.load("my_model.pkl")
55
+
56
+ if st.button("Predict"):
57
+ prediction = load_model.predict(input)
58
+
59
+ if prediction == 1:
60
+ prediction = 'Placed'
61
+ else:
62
+ prediction = 'Not Placed'
63
+
64
+ st.subheader('Based on user input, the placement model predicted: ')
65
+ st.header(prediction)