qothi commited on
Commit
150afb8
1 Parent(s): 45d93b7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -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("my_model.pkl")
56
+
57
+ if st.sidebar.button('Predict'):
58
+ prediction = load_model.predict(input)
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)