Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- module.py +21 -0
- placement.ipynb +0 -0
- placement.pkl +3 -0
- placement_APP.py +68 -0
- placementdata.csv +0 -0
- requirements.txt +3 -0
module.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
def data_info(dataset):
|
| 3 |
+
try:
|
| 4 |
+
col_name = [] #save col name
|
| 5 |
+
Count = []
|
| 6 |
+
Missing = []
|
| 7 |
+
N_unique = []
|
| 8 |
+
Unique = []
|
| 9 |
+
Dtype = []
|
| 10 |
+
for col in dataset.columns:
|
| 11 |
+
col_name.append(col)
|
| 12 |
+
Count.append(dataset[col].count())
|
| 13 |
+
Missing.append(dataset[col].isna().sum())
|
| 14 |
+
N_unique.append(dataset[col].nunique())
|
| 15 |
+
Unique.append(dataset[col].unique())
|
| 16 |
+
Dtype.append(dataset[col].dtype)
|
| 17 |
+
return pd.DataFrame({"Col_Name" : col_name , "Dtype" : Dtype ,
|
| 18 |
+
"N_unique" : N_unique , "Count" : Count ,
|
| 19 |
+
"Missing" : Missing , "Unique": Unique })
|
| 20 |
+
except Exception as e :
|
| 21 |
+
print("Error: ",e)
|
placement.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
placement.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df27a9aa2cb587e1ab67118bbc4fefd6bdce9525bb377c13070135ce502f8534
|
| 3 |
+
size 937
|
placement_APP.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pickle
|
| 3 |
+
import numpy as np
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
import requests
|
| 6 |
+
import io
|
| 7 |
+
|
| 8 |
+
@st.cache_resource
|
| 9 |
+
def load_model():
|
| 10 |
+
url = "https://github.com/Ali-Abdelhamid-Ali/placement/blob/main/placement.pkl?raw=true"
|
| 11 |
+
response = requests.get(url)
|
| 12 |
+
|
| 13 |
+
if response.status_code == 200:
|
| 14 |
+
model = pickle.load(io.BytesIO(response.content))
|
| 15 |
+
return model
|
| 16 |
+
else:
|
| 17 |
+
st.error("Failed to download the model.")
|
| 18 |
+
return None
|
| 19 |
+
|
| 20 |
+
best_model = load_model()
|
| 21 |
+
|
| 22 |
+
def classify_placement(CGPA, Internships, Projects, Workshops_Certifications, AptitudeTestScore,
|
| 23 |
+
SoftSkillsRating, ExtracurricularActivities, PlacementTraining, SSC_Marks, HSC_Marks):
|
| 24 |
+
input_data = (CGPA, Internships, Projects, Workshops_Certifications, AptitudeTestScore,
|
| 25 |
+
SoftSkillsRating, ExtracurricularActivities, PlacementTraining, SSC_Marks, HSC_Marks)
|
| 26 |
+
|
| 27 |
+
input_data_as_numpy_array = np.asarray(input_data)
|
| 28 |
+
input_data_reshaped = input_data_as_numpy_array.reshape(1, -1)
|
| 29 |
+
|
| 30 |
+
prediction = best_model.predict(input_data_reshaped)
|
| 31 |
+
|
| 32 |
+
return prediction
|
| 33 |
+
|
| 34 |
+
def visualize_data(CGPA, prediction):
|
| 35 |
+
fig, ax = plt.subplots(figsize=(6, 4))
|
| 36 |
+
ax.bar(['Not Placed', 'Placed'], [1 - prediction, prediction], color=['red', 'green'])
|
| 37 |
+
ax.set_title(f'Placement Prediction for CGPA: {CGPA}')
|
| 38 |
+
ax.set_ylabel('Probability')
|
| 39 |
+
ax.set_ylim(0, 1)
|
| 40 |
+
st.pyplot(fig)
|
| 41 |
+
|
| 42 |
+
def main():
|
| 43 |
+
st.title("Placement Prediction App")
|
| 44 |
+
st.write("Predicts student placement success based on academic performance and skills.")
|
| 45 |
+
|
| 46 |
+
CGPA = st.slider("CGPA", 0.0, 10.0, 7.0, 0.01)
|
| 47 |
+
Internships = st.slider("Number of Internships", 0, 20, 3)
|
| 48 |
+
Projects = st.slider("Number of Projects", 0, 100, 10)
|
| 49 |
+
Workshops_Certifications = st.slider("Number of Workshops and Certifications", 0, 10, 4)
|
| 50 |
+
AptitudeTestScore = st.slider("Aptitude Test Score", 0, 100, 70)
|
| 51 |
+
SoftSkillsRating = st.slider("Soft Skills Rating", 0, 5, 2)
|
| 52 |
+
ExtracurricularActivities = st.slider("Extracurricular Activities", 0, 5, 1)
|
| 53 |
+
PlacementTraining = st.slider("Placement Training", 1, 8, 0)
|
| 54 |
+
SSC_Marks = st.slider("SSC Marks", 0, 100, 75)
|
| 55 |
+
HSC_Marks = st.slider("HSC Marks", 0, 100, 80)
|
| 56 |
+
|
| 57 |
+
if st.button("Predict"):
|
| 58 |
+
prediction = classify_placement(CGPA, Internships, Projects, Workshops_Certifications, AptitudeTestScore,
|
| 59 |
+
SoftSkillsRating, ExtracurricularActivities, PlacementTraining, SSC_Marks, HSC_Marks)
|
| 60 |
+
|
| 61 |
+
if prediction[0] == 1:
|
| 62 |
+
st.write("The student will be placed.")
|
| 63 |
+
else:
|
| 64 |
+
st.markdown("The student will <span style='color:red;'>NOT</span> be placed.", unsafe_allow_html=True)
|
| 65 |
+
|
| 66 |
+
visualize_data(CGPA, prediction[0])
|
| 67 |
+
|
| 68 |
+
main()
|
placementdata.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
matplotlib
|
| 2 |
+
numpy
|
| 3 |
+
streamlit
|