shikharyashmaurya
commited on
Commit
•
4c9653e
1
Parent(s):
cd70789
Upload 2 files
Browse files- model_campus +0 -0
- xyz.py +79 -0
model_campus
ADDED
Binary file (1.39 kB). View file
|
|
xyz.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import joblib
|
3 |
+
import pandas as pd
|
4 |
+
#st.title('Placement Prediction app')
|
5 |
+
# st.markdown("""
|
6 |
+
# <style>
|
7 |
+
# .title {
|
8 |
+
# font-size: 50px;
|
9 |
+
# font-weight: bold;
|
10 |
+
# color: #4CAF50;
|
11 |
+
# text-align: center;
|
12 |
+
# font-family: 'Courier New', Courier, monospace;
|
13 |
+
# }
|
14 |
+
# </style>
|
15 |
+
# """, unsafe_allow_html=True)
|
16 |
+
|
17 |
+
|
18 |
+
# st.title('Placement Prediction App')
|
19 |
+
# st.subheader('Predicting student placement outcomes using machine learning')
|
20 |
+
# st.markdown('This app uses historical data to predict whether a student will be placed in a company based on their profile.')
|
21 |
+
|
22 |
+
try:
|
23 |
+
model = joblib.load('model_campus')
|
24 |
+
st.success("Model loaded successfully!")
|
25 |
+
except Exception as e:
|
26 |
+
st.error(f"Error loading model: {e}")
|
27 |
+
st.stop()
|
28 |
+
# model = joblib.load(open('model_campus_placement_rf.joblib','rb'))
|
29 |
+
|
30 |
+
def predict_placement(data):
|
31 |
+
# Preprocess the data
|
32 |
+
# new_data = pd.DataFrame(data)
|
33 |
+
new_data = pd.DataFrame(data, index=[0])
|
34 |
+
|
35 |
+
# Make prediction
|
36 |
+
prediction = model.predict(new_data)[0]
|
37 |
+
prob = model.predict_proba(new_data)[0][1]
|
38 |
+
|
39 |
+
return prediction, prob
|
40 |
+
|
41 |
+
def main():
|
42 |
+
st.header('Placement Prediciton App')
|
43 |
+
|
44 |
+
gender = st.radio('Gender', ['Male', 'Female'])
|
45 |
+
ssc_p = st.number_input('Secondary School Percentage', min_value=0.0, max_value=100.0, value=50.0, step=0.1)
|
46 |
+
ssc_b = st.radio('Board of Education (SSC)', ['Central', 'Others'])
|
47 |
+
hsc_p = st.number_input('Higher Secondary Percentage', min_value=0.0, max_value=100.0, value=50.0, step=0.1)
|
48 |
+
hsc_b = st.radio('Board of Education (HSC)', ['Central', 'Others'])
|
49 |
+
degree_p = st.number_input('UG Percentage', min_value=0.0, max_value=100.0, value=50.0, step=0.1)
|
50 |
+
branch = st.selectbox('Branch of Study', ['CSE', 'ECE/EN', 'Others'])
|
51 |
+
workex = st.radio('Work Experience', ['Yes', 'No'])
|
52 |
+
certifications = st.number_input('Number of Certifications', min_value=0, max_value=10, value=0)
|
53 |
+
etest_p = st.number_input('Employability Percentage', min_value=0.0, max_value=100.0, value=50.0, step=0.1)
|
54 |
+
backlogs = st.number_input('Number of Backlogs', min_value=0, max_value=10, value=0)
|
55 |
+
|
56 |
+
if st.button('predict'):
|
57 |
+
new_data = {
|
58 |
+
'gender': 0 if gender == "Male" else 1,
|
59 |
+
'ssc_p': ssc_p,
|
60 |
+
'ssc_b': 1 if ssc_b == "Central" else 0,
|
61 |
+
'hsc_p': hsc_p,
|
62 |
+
'hsc_b': 1 if hsc_b == "Central" else 0,
|
63 |
+
'degree_p': degree_p,
|
64 |
+
'Branch': 2 if branch == "ECE/EN" else 1 if branch == "CSE" else 0,
|
65 |
+
'Workex': 1 if workex == "Yes" else 0,
|
66 |
+
'Certifications': certifications,
|
67 |
+
'etest_p': etest_p,
|
68 |
+
'Backlogs': backlogs,
|
69 |
+
}
|
70 |
+
|
71 |
+
# st.write(new_data)
|
72 |
+
|
73 |
+
prediction, probability = predict_placement(new_data)
|
74 |
+
st.write(f'Percentage of getting placed: {probability*100:.2f}%')
|
75 |
+
|
76 |
+
|
77 |
+
if __name__=='__main__':
|
78 |
+
main()
|
79 |
+
|