Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,14 @@ def make_prediction(model, input_data):
|
|
13 |
return prediction
|
14 |
|
15 |
# Define the function to calculate GPA
|
16 |
-
def calculate_gpa(
|
17 |
-
if
|
18 |
return 'A (5 points)'
|
19 |
-
elif
|
20 |
return 'B (4 points)'
|
21 |
-
elif
|
22 |
return 'C (3 points)'
|
23 |
-
elif
|
24 |
return 'D (2 points)'
|
25 |
else:
|
26 |
return 'F (0 points)'
|
@@ -46,16 +46,16 @@ def main():
|
|
46 |
mid_semester = st.slider("Mid Semester Score", min_value=1, max_value=20, step=1)
|
47 |
assignments = st.slider("Assignments", min_value=1, max_value=10, step=1)
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
|
52 |
-
# Make
|
53 |
if st.button("Predict Exam Score"):
|
54 |
-
prediction = make_prediction(model,
|
55 |
st.write(f"Predicted Exam Score: {prediction[0]:.2f}")
|
56 |
-
|
57 |
# Calculate GPA
|
58 |
-
gpa = calculate_gpa(
|
59 |
st.write(f"Predicted GPA: {gpa}")
|
60 |
|
61 |
if __name__ == '__main__':
|
|
|
13 |
return prediction
|
14 |
|
15 |
# Define the function to calculate GPA
|
16 |
+
def calculate_gpa(total_score):
|
17 |
+
if total_score >= 70:
|
18 |
return 'A (5 points)'
|
19 |
+
elif total_score >= 60:
|
20 |
return 'B (4 points)'
|
21 |
+
elif total_score >= 50:
|
22 |
return 'C (3 points)'
|
23 |
+
elif total_score >= 45:
|
24 |
return 'D (2 points)'
|
25 |
else:
|
26 |
return 'F (0 points)'
|
|
|
46 |
mid_semester = st.slider("Mid Semester Score", min_value=1, max_value=20, step=1)
|
47 |
assignments = st.slider("Assignments", min_value=1, max_value=10, step=1)
|
48 |
|
49 |
+
# Calculate total score
|
50 |
+
total_score = attendance + mid_semester + assignments
|
51 |
|
52 |
+
# Make prediction
|
53 |
if st.button("Predict Exam Score"):
|
54 |
+
prediction = make_prediction(model, np.array([[level, course_units, total_score]]))
|
55 |
st.write(f"Predicted Exam Score: {prediction[0]:.2f}")
|
56 |
+
|
57 |
# Calculate GPA
|
58 |
+
gpa = calculate_gpa(total_score)
|
59 |
st.write(f"Predicted GPA: {gpa}")
|
60 |
|
61 |
if __name__ == '__main__':
|