Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
"
|
| 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 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 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 |
-
|
| 37 |
-
|
| 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()
|