Upload 3 files
Browse files- app.py +80 -0
- requirements.txt +5 -0
- student_performance_model.h5 +3 -0
app.py
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
## importing the necessary libraries
|
3 |
+
import streamlit as st
|
4 |
+
import joblib
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
## to save the model
|
8 |
+
#joblib.dump(mode_name,"the path where you want to save the model")
|
9 |
+
|
10 |
+
|
11 |
+
## to load the model
|
12 |
+
|
13 |
+
model = joblib.load("student_performance_model.h5")
|
14 |
+
|
15 |
+
|
16 |
+
def predict_marks(Hours_studied,Previous_score , Extracurriculum_activities, sleep_hours , sample_question):
|
17 |
+
#predict the students marks based on the input data
|
18 |
+
|
19 |
+
input_data = np.array([[Hours_studied,Previous_score , Extracurriculum_activities, sleep_hours , sample_question]])
|
20 |
+
prediction = model.predict(input_data)
|
21 |
+
prediction = round(float(prediction),2)
|
22 |
+
|
23 |
+
|
24 |
+
## ensure the prediction does not exceed 100
|
25 |
+
|
26 |
+
if prediction > 100:
|
27 |
+
prediction = 100
|
28 |
+
|
29 |
+
return prediction
|
30 |
+
|
31 |
+
|
32 |
+
def main():
|
33 |
+
|
34 |
+
st.title("Student Performance Prediction")
|
35 |
+
|
36 |
+
## input data
|
37 |
+
|
38 |
+
name = st.text_input("enter your name")
|
39 |
+
|
40 |
+
Hours_studied = st.number_input("number of hours you studied",min_value = 0.0 ,max_value=18.0,value = 0.0)
|
41 |
+
|
42 |
+
Previous_score = st.number_input("enter your previous score",min_value = 0.0 ,max_value=100.0,value = 0.0)
|
43 |
+
|
44 |
+
Extracurriculum_Activites = st.number_input("no.of extracurricular activities done",min_value = 0.0,max_value = 10.0 ,value= 0.0 )
|
45 |
+
|
46 |
+
sleep_hours = st.number_input ("Hours you slept", min_value =0.0,max_value = 12.0, value = 0.0)
|
47 |
+
|
48 |
+
sample_questions = st.number_input ("number of sample paper you solved", min_value =0.0,max_value = 20.0, value = 0.0)
|
49 |
+
|
50 |
+
## sidebar interaction
|
51 |
+
|
52 |
+
st.sidebar.title(f"# hey {name}")
|
53 |
+
st.sidebar.title(f"Welcome to your Marks predictor!...")
|
54 |
+
|
55 |
+
|
56 |
+
## prediction button
|
57 |
+
|
58 |
+
if st.button("Predict your Marks"):
|
59 |
+
prediction = predict_marks(Hours_studied,Previous_score , Extracurriculum_Activites,sleep_hours ,sample_questions)
|
60 |
+
|
61 |
+
|
62 |
+
## display the prediction
|
63 |
+
|
64 |
+
if prediction >=90:
|
65 |
+
st.balloons()
|
66 |
+
st.success(f"congrats {name} you are on a track to score {prediction} marks!.kepp it up ")
|
67 |
+
elif prediction>=35:
|
68 |
+
st.warning(f"hey {name} you are on a track to score {prediction} marks. but there's a room to aim higher!")
|
69 |
+
else:
|
70 |
+
st.error(f"{name} , oh no you might fail the exam as you will be getting {prediction}, work hard and conncentrate on your studies")
|
71 |
+
|
72 |
+
|
73 |
+
if __name__ =="__main__":
|
74 |
+
main()
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas==2.0.3
|
2 |
+
joblib==1.2.0
|
3 |
+
numpy==1.24.3
|
4 |
+
streamlit==1.37.0
|
5 |
+
scikit-learn
|
student_performance_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4157ea9e74dc017119fd526cc588e579c595ba7ab8ba62f5b7213eec0316d811
|
3 |
+
size 1040
|