Spaces:
Runtime error
Runtime error
File size: 2,747 Bytes
64a481a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
import streamlit as st
import pickle
import pandas as pd
# Load the trained models
rf_fullstk = pickle.load(open('rf_hacathon_fullstk.pkl', 'rb'))
rf_prodengg = pickle.load(open('rf_hacathon_prodengg.pkl', 'rb'))
rf_mkt = pickle.load(open('rf_hacathon_mkt.pkl', 'rb'))
# Define the function for prediction
def predict_placement(degree_p, internship, DSA, java, management, leadership, communication, sales, model):
data = pd.DataFrame({
'degree_p': degree_p,
'internship': internship,
'DSA': DSA,
'java': java,
'management': management,
'leadership': leadership,
'communication': communication,
'sales': sales
}, index=[0])
prediction = model.predict(data)[0]
probability = model.predict_proba(data)[0][1]
return prediction, probability
# Create the Streamlit app
def main():
st.title("Placement Prediction App")
st.sidebar.title("Options")
options = ["Full Stack Engineer", "Marketing", "Production Engineer"]
job_role = st.sidebar.selectbox("Select Job Role", options)
degree_p = st.slider("Degree Percentage", 0, 100, 50)
internship = st.radio("Internship", ["Yes", "No"])
DSA = st.radio("DSA Knowledge", [0, 1])
java = st.radio("Java Knowledge", [0, 1])
if job_role == "Full Stack Engineer":
management = st.slider("Management Skills", 0, 5, 0)
leadership = st.slider("Leadership Skills", 0, 5, 0)
communication = st.slider("Communication Skills", 0, 5, 0)
sales = st.slider("Sales Skills", 0, 5, 0)
prediction, probability = predict_placement(degree_p, internship, DSA, java, management, leadership, communication, sales, rf_fullstk)
elif job_role == "Marketing":
management = st.slider("Management Skills", 0, 5, 0)
leadership = st.slider("Leadership Skills", 0, 5, 0)
DSA = st.slider("DSA Knowledge", 0, 5, 0)
java = st.slider("Java Knowledge", 0, 5, 0)
prediction, probability = predict_placement(degree_p, internship, DSA, java, management, leadership, communication, sales, rf_mkt)
elif job_role == "Production Engineer":
communication = st.slider("Communication Skills", 0, 5, 0)
sales = st.slider("Sales Skills", 0, 5, 0)
management = st.slider("Management Skills", 0, 5, 0)
leadership = st.slider("Leadership Skills", 0, 5, 0)
prediction, probability = predict_placement(degree_p, internship, DSA, java, management, leadership, communication, sales, rf_prodengg)
if prediction == 1:
st.success("Placed")
st.success(f"You will be placed with a probability of {probability:.2f}")
else:
st.warning("Not Placed")
if __name__ == '__main__':
main()
|