import streamlit as st import torch import torch.nn as nn import torch.nn.functional as F import base64 st.markdown( """ """, unsafe_allow_html=True ) st.title("Placement Analysis") # Define the ANN model architecture class ANN_Model(nn.Module): def __init__(self, input_cols=10, hidden1=20, hidden2=20, output=1): super(ANN_Model, self).__init__() self.f_connected1 = nn.Linear(input_cols, hidden1) self.f_connected2 = nn.Linear(hidden1, hidden2) self.out = nn.Linear(hidden2, output) def forward(self, x): x = F.relu(self.f_connected1(x)) x = F.relu(self.f_connected2(x)) x = torch.sigmoid(self.out(x)) return x # Load the model model = ANN_Model() model.load_state_dict(torch.load("ANN_model.pth")) model.eval() # Create three columns for input fields col1, col2, col3 = st.columns(3) with col1: SoftSkillsRating = st.number_input("Soft Skills Rating (0 to 5)", min_value=0, max_value=5, step=1) cgpa = st.number_input("Enter your CGPA (1 to 10)", min_value=0.0, max_value=10.0, step=0.01) internships = st.number_input("Number of Internships", min_value=0, max_value=10, step=1) with col2: AptitudeTestScore = st.number_input("Aptitude Test Score(%)", min_value=0, max_value=100, step=1) SSC_Marks = st.number_input("SSC Marks (%)", min_value=0, max_value=100, step=1) HSC_Marks = st.number_input("HSC Marks(%)", min_value=0, max_value=100, step=1) with col3: PlacementTraining = st.selectbox("Placement Training", ["Yes", "No"]) PlacementTraining = 1 if PlacementTraining == "Yes" else 0 certifications = st.selectbox("Do you have certifications?", ["Yes", "No"]) certifications = 1 if certifications == "Yes" else 0 ExtracurricularActivities = st.selectbox("Extracurricular Activities", ["Yes", "No"]) ExtracurricularActivities = 1 if ExtracurricularActivities == "Yes" else 0 projects = st.number_input("Number of Projects", min_value=0, max_value=20, step=1) # Predict Button if st.button("Predict Placement"): # Prepare input for model input_data = torch.tensor([[ cgpa, internships, projects, certifications, AptitudeTestScore, SoftSkillsRating, ExtracurricularActivities, PlacementTraining, SSC_Marks, HSC_Marks ]], dtype=torch.float32) # Make a prediction with torch.no_grad(): output = model(input_data).item() if output >= 0.5: st.markdown( """

🎉 Congratulations! You are likely to get placed.

""", unsafe_allow_html=True ) else: st.markdown( """

⚠️ You might need to improve your profile for better chances.

""", unsafe_allow_html=True )