DataMine commited on
Commit
276c6fc
ยท
verified ยท
1 Parent(s): d60e3c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -34
app.py CHANGED
@@ -1,48 +1,55 @@
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()
 
 
 
 
1
  import numpy as np
2
  import joblib
3
  import streamlit as st
4
 
 
 
5
  # Load the trained model
6
  model = joblib.load("student_performance_model.h5")
7
 
8
+ def predict_marks(Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question):
9
+ "Predict the student marks based on the input data"
10
+ input_data = np.array([[Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question]])
11
+ prediction = model.predict(input_data)
12
+ return round(float(prediction), 2)
13
 
14
  def main():
15
+ # Sidebar Welcome Note with Emojis
16
+ st.sidebar.title("๐ŸŽ‰ Welcome to the Marks Oracle! ๐ŸŽ‰")
17
+ st.sidebar.write("""
18
+ **Prepare to be amazed** as this super-genius AI predicts your future marks with the accuracy of a caffeinated fortune cookie.
19
+ Just enter how much you've studied (or napped ๐Ÿ˜ด), and let the magic happen!
 
 
 
 
 
 
 
 
 
 
20
 
21
+ Remember, this AI never sleeps... but you should! ๐Ÿ˜‰
22
+ """)
 
 
 
 
 
23
 
24
+ st.sidebar.markdown("---")
25
 
26
+ st.title("๐Ÿ“š Student Marks Predictor ๐Ÿ“Š")
27
 
28
+ # Input data
29
+ name = st.text_input("๐Ÿ‘ค Enter your name")
30
+ Hours_studied = st.number_input("๐Ÿ“– Hours you studied", min_value=0.0, max_value=20.0, value=0.0)
31
+ Previous_Score = st.number_input("๐Ÿ“Š Previous exam score", min_value=0, max_value=100, value=0)
32
+ Extracurriculum_Activivities = st.number_input("๐ŸŽญ Extracurricular activities done", min_value=0, max_value=10, value=0)
33
+ Sleep_Hours = st.number_input("๐Ÿ˜ด Hours you slept", min_value=0.0, max_value=12.0, value=0.0)
34
+ Sample_Question = st.number_input("โœ๏ธ Sample questions practiced", min_value=0, max_value=50, value=0)
35
+
36
+ # Sidebar interaction
37
+ if name:
38
+ st.sidebar.write(f"### Welcome, **{name}**! ๐Ÿ‘‹")
39
+ st.sidebar.write("#### Let's check your upcoming marks by entering your details below.")
40
+
41
+ # Predict button
42
+ if st.button("๐Ÿ”ฎ Predict Your Marks"):
43
+ prediction = predict_marks(Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question)
44
+
45
+ # Display the predictions
46
+ if prediction >= 90:
47
+ st.balloons()
48
+ st.success(f"๐ŸŒŸ **{name}, amazing!** You're on track to score {prediction} marks! Keep up the excellent work! ๐Ÿ’ช")
49
+ elif prediction >= 35:
50
+ st.warning(f"โš ๏ธ **{name}, not bad!** You're likely to pass with {prediction} marks, but there's room to aim higher! ๐Ÿš€")
51
+ else:
52
+ st.error(f"๐Ÿšจ **{name}, oh no!** You might score below 35 marks. Consider putting in some more effort! ๐Ÿ“š")
53
 
54
+ if __name__ == "__main__":
55
+ main()