File size: 2,428 Bytes
8fec50f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import joblib

model = joblib.load('model.pkl')
st.title("🤯 Student Result Predictor")

# take the input 
gender = st.selectbox('Gender', ['Female','Male'])
ethinic = st.selectbox('ethinic',['Group A','Group B','Group C','Group D', 'Group E'])
parent_education = st.selectbox('parent education',["bachelor's degree","Associate's Degree","some college","high school","master's degree","some high school"])
lunch = st.selectbox('Lunch', ['standard', 'free/reduced'])
test_preparation = st.selectbox('Test Preparation', ['Completed','None'])
math_score = st.number_input('Math Score',0, 100)
Reading_score = st.number_input('Reading Score',0, 100)
Writing_score = st.number_input('Writing Score',0, 100)

# ethinic case
group_A = group_B = group_C = group_D = group_E = 0
if ethinic == 'Group B':
    group_B = 1
elif ethinic == 'Group C':
    group_C = 1
elif ethinic == 'Group D':
    group_D = 1
else:
    group_E = 1

# parent education case,
associate = bachelor = highschool = master = some_college = some_school = 0
if parent_education == "bachelor's degree":
    bachelor = 1
elif parent_education == "some college":
    some_college = 1
elif parent_education == "high school":
    highschool = 1
elif parent_education == "master's degree":
    master = 1
elif parent_education == "associate's degree":
    associate = 1
else:
    some_school = 1

# gender case
if gender == 'male':
    gender = 1
else:
    gender = 0

# lunch case
if lunch == 'standard':
    lunch = 1
else:
    lunch = 0

# test Preparation
if test_preparation == 'None':
    test_preparation = 1
else:
    test_preparation = 0


input_data = pd.DataFrame({
    'math score':[math_score],
    'reading score':[Reading_score],
    'writing score':[Writing_score],
    'group_A':[group_A],
    'group_B':[group_B],
    'group_C':[group_C],
    'group_D':[group_D],
    'group_E':[group_E],
    'associate':[associate],
    'bachelor':[bachelor],
    'high_school':[highschool],
    'master':[master],
    'some_college':[some_college],
    'some_school':[some_school],
    'gender':[gender],
    'lunch_standard':[lunch],
    'preparation':[test_preparation]
})


# predict output
if st.button("Predict"):
    prediction = model.predict(input_data)[0]
    st.success("🥳 Pass" if prediction == 1 else "⛔ Fail,Try Hard")