DataMine commited on
Commit
6fc2fd8
·
verified ·
1 Parent(s): 1f5dc6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -48
app.py CHANGED
@@ -1,48 +1,48 @@
1
-
2
- # Hours Studied Previous Scores Extracurricular Activities Sleep Hours Sample Question Papers Practiced Performance Index\
3
-
4
- import numpy as np
5
- import joblib
6
- import streamlit as st
7
-
8
-
9
-
10
- # Load the trained model
11
- model = joblib.load(r"C:\Users\asgar\Downloads\machine learning HN\models\student_performance_model.h5")
12
-
13
- def predict_marks(Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question):
14
- "predict the student marks based on the input data"
15
- input_data = np.array([[Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question]])
16
- prediction= model.predict(input_data)
17
- return round(float(prediction),2)
18
-
19
- def main():
20
- st.title("Student Marks Predictor")
21
-
22
- #Input data
23
- name = st.text_input("Enter your name")
24
- Hours_studied = st.number_input("Enter the number of Hours you Studied", min_value=0.0,max_value=20.0,value=0.0)
25
- Previous_Score = st.number_input("Enter your Previous exam Score", min_value=0,max_value=100,value=0)
26
- Extracurriculum_Activivities = st.number_input("Enter the number extracurriculum activities you have done",min_value=0,max_value=10,value=0)
27
- Sleep_Hours = st.number_input("Enter the number of hours you slept",min_value=0.0,max_value=12.0,value=0.0)
28
- Sample_Question = st.number_input("Enter the number of Sample Question you have practiced",min_value=0,max_value=50,value=0)
29
-
30
- # predict
31
- st.sidebar.write(f"# hi {name}")
32
- st.sidebar.write("##### i am a helpful students marks predictor here to assist you in predicting your marks")
33
- if st.button("Predict"):
34
- prediction = predict_marks(Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question)
35
-
36
- # Display the predictions
37
- if prediction >=90:
38
- st.success(f"{name} You have a high chances of passing with the the exceptional marks of {prediction} marks keep it up")
39
- elif prediction >=35:
40
- st.success(f"{name} You have chances of Passing with {prediction} marks try to get 90+")
41
- else:
42
- st.error(f"{name} You have a very high chances of failing")
43
-
44
-
45
-
46
-
47
- if __name__=="__main__":
48
- main()
 
1
+
2
+ # Hours Studied Previous Scores Extracurricular Activities Sleep Hours Sample Question Papers Practiced Performance Index\
3
+
4
+ import numpy as np
5
+ import joblib
6
+ import streamlit as st
7
+
8
+
9
+
10
+ # Load the trained model
11
+ model = joblib.load("student_performance_model.h5")
12
+
13
+ def predict_marks(Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question):
14
+ "predict the student marks based on the input data"
15
+ input_data = np.array([[Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question]])
16
+ prediction= model.predict(input_data)
17
+ return round(float(prediction),2)
18
+
19
+ def main():
20
+ st.title("Student Marks Predictor")
21
+
22
+ #Input data
23
+ name = st.text_input("Enter your name")
24
+ Hours_studied = st.number_input("Enter the number of Hours you Studied", min_value=0.0,max_value=20.0,value=0.0)
25
+ Previous_Score = st.number_input("Enter your Previous exam Score", min_value=0,max_value=100,value=0)
26
+ Extracurriculum_Activivities = st.number_input("Enter the number extracurriculum activities you have done",min_value=0,max_value=10,value=0)
27
+ Sleep_Hours = st.number_input("Enter the number of hours you slept",min_value=0.0,max_value=12.0,value=0.0)
28
+ Sample_Question = st.number_input("Enter the number of Sample Question you have practiced",min_value=0,max_value=50,value=0)
29
+
30
+ # predict
31
+ st.sidebar.write(f"# hi {name}")
32
+ st.sidebar.write("##### i am a helpful students marks predictor here to assist you in predicting your marks")
33
+ if st.button("Predict"):
34
+ prediction = predict_marks(Hours_studied,Previous_Score,Extracurriculum_Activivities,Sleep_Hours,Sample_Question)
35
+
36
+ # Display the predictions
37
+ if prediction >=90:
38
+ st.success(f"{name} You have a high chances of passing with the the exceptional marks of {prediction} marks keep it up")
39
+ elif prediction >=35:
40
+ st.success(f"{name} You have chances of Passing with {prediction} marks try to get 90+")
41
+ else:
42
+ st.error(f"{name} You have a very high chances of failing")
43
+
44
+
45
+
46
+
47
+ if __name__=="__main__":
48
+ main()