-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_eval.py
More file actions
82 lines (67 loc) · 2.3 KB
/
model_eval.py
File metadata and controls
82 lines (67 loc) · 2.3 KB
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
import streamlit as st
import pandas as pd
import pickle
# Load the model
@st.cache_resource
def load_model():
with open("data/model.pkl", "rb") as f:
model = pickle.load(f)
st.success("Model loaded successfully!")
return model
# Page config
st.set_page_config(page_title="College Admission Predictor", page_icon="🎓")
st.title("College Admission Predictor")
st.write("Enter your information to see if you'll be admitted!")
# Load model
model = load_model()
# Create input form
with st.form("admission_form"):
st.subheader("Your Academic Profile")
col1, col2 = st.columns(2)
with col1:
gre = st.number_input("GRE Score", min_value=260, max_value=340, value=310)
toefl = st.number_input("TOEFL Score", min_value=0, max_value=120, value=100)
uni_rating = st.slider("University Rating", min_value=1, max_value=5, value=3)
cgpa = st.number_input(
"CGPA", min_value=0.0, max_value=10.0, value=8.0, step=0.1
)
with col2:
sop = st.slider(
"SOP Strength", min_value=1.0, max_value=5.0, value=3.0, step=0.5
)
lor = st.slider(
"LOR Strength", min_value=1.0, max_value=5.0, value=3.0, step=0.5
)
research = st.selectbox(
"Research Experience",
options=[0, 1],
format_func=lambda x: "Yes" if x == 1 else "No",
)
submitted = st.form_submit_button("Predict My Admission!")
# Make prediction when form is submitted
if submitted:
# Create dataframe with user input
user_data = pd.DataFrame(
{
"GRE Score": [gre],
"TOEFL Score": [toefl],
"University Rating": [uni_rating],
"SOP": [sop],
"LOR": [lor],
"CGPA": [cgpa],
"Research": [research],
}
)
# Make prediction
prediction = model.predict(user_data)[0]
# Show result
st.markdown("---")
if prediction:
st.success("**Congratulations! You're likely to be admitted!**")
st.balloons()
else:
st.error("**Sorry, admission unlikely with current profile.**")
st.write("Consider improving your scores or gaining research experience.")
# Show the input data
with st.expander("Your Profile Summary"):
st.dataframe(user_data)