File size: 4,551 Bytes
f3306ac
 
 
 
 
 
e55aa8b
 
 
 
 
 
e8b54b0
e55aa8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3306ac
85d0fb4
f3306ac
 
85d0fb4
f3306ac
 
 
 
 
 
 
7ad4884
f3306ac
 
 
85d0fb4
 
 
f3306ac
85d0fb4
ca8ae13
 
 
7ad4884
6df818c
ca8ae13
6b264a2
eaad58a
ca8ae13
 
6df818c
7ad4884
 
e8b54b0
ca8ae13
 
 
 
7ad4884
 
 
 
6b264a2
ca8ae13
f3306ac
 
 
85d0fb4
 
 
 
 
 
f3306ac
85d0fb4
f3306ac
ad15103
 
 
 
 
 
 
 
f3306ac
 
a5ba299
85d0fb4
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import streamlit as st
import torch
import torch.nn as nn
import torch.nn.functional as F
import base64


st.markdown(
    """
    <style>
    /* Set background image for the entire app */
    .stApp {
        background: url('https://www.mrscindore.org/images/placements.jpg') no-repeat center center fixed;
        background-size: cover;
    }
    
    /* Style for the title */
    .stApp h1 {
        background-color: rgba(0, 0, 128, 0.7); 
        color: #ffffff; /* White */
        padding: 10px;
        border-radius: 5px;
        font-size: 2.5em; 
        text-align: center;
    }
    /* Style for input text area */
    .stTextArea textarea {
        background-color: rgba(255, 255, 255, 0.8); 
        color: #000000; /* Black */
        font-size: 1.2em; 
    }
    /* Style for the button */
    .stButton>button {
        background-color: #4CAF50; /* Green */
        color: white;
        font-size: 1.2em;
        border-radius: 10px;
        padding: 10px 24px;
        border: none;
    }
    /* Center the button */
    .stButton {
        display: flex;
        justify-content: center;
    }
    /* Style for the output container */
    .output-container {
        background-color: lightpink;
        color: black;
        font-size: 1.5em;
        padding: 15px;
        border-radius: 10px;
        margin-top: 20px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        width: 200%;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }
    
    </style>
    """,
    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(
                """
                <div style='background-color: #d4edda; padding: 10px; border-radius: 5px;'>
                    <h4 style='color: #155724;'>🎉 Congratulations! You are likely to get placed.</h4>
                </div>
                """,
                unsafe_allow_html=True
            )
        else:
            st.markdown(
                """
                <div style='background-color: #f8d7da; padding: 10px; border-radius: 5px;'>
                    <h4 style='color: #721c24;'>⚠️ You might need to improve your profile for better chances.</h4>
                </div>
                """,
                unsafe_allow_html=True
            )