|
|
import numpy as np |
|
|
import joblib |
|
|
import streamlit as st |
|
|
|
|
|
|
|
|
model = joblib.load("student_performance_model.h5") |
|
|
|
|
|
def predict_marks(Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question): |
|
|
"Predict the student marks based on the input data" |
|
|
input_data = np.array([[Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question]]) |
|
|
prediction = model.predict(input_data) |
|
|
prediction = round(float(prediction), 2) |
|
|
|
|
|
|
|
|
if prediction > 100: |
|
|
prediction = 100 |
|
|
|
|
|
return prediction |
|
|
|
|
|
def main(): |
|
|
|
|
|
|
|
|
|
|
|
st.title("๐ Student Marks Predictor ๐") |
|
|
|
|
|
|
|
|
name = st.text_input("๐ค Enter your name") |
|
|
Hours_studied = st.number_input("๐ Hours you studied", min_value=0.0, max_value=20.0, value=0.0) |
|
|
Previous_Score = st.number_input("๐ Previous exam score", min_value=0, max_value=100, value=0) |
|
|
Extracurriculum_Activivities = st.number_input("๐ญ Extracurricular activities done", min_value=0, max_value=10, value=0) |
|
|
Sleep_Hours = st.number_input("๐ด Hours you slept", min_value=0.0, max_value=12.0, value=0.0) |
|
|
Sample_Question = st.number_input("โ๏ธ Sample questions practiced", min_value=0, max_value=50, value=0) |
|
|
|
|
|
|
|
|
st.sidebar.title(f" # Hey {name}") |
|
|
st.sidebar.title(f"๐Welcome to your Marks Predictor! ๐") |
|
|
st.sidebar.write(""" |
|
|
Hey there! Ready to see what your future marks might be? ๐ |
|
|
|
|
|
Remember, I'm here to help you succeed! ๐ช |
|
|
""") |
|
|
|
|
|
st.sidebar.markdown("---") |
|
|
|
|
|
|
|
|
if st.button("๐ฎ Predict Your Marks"): |
|
|
prediction = predict_marks(Hours_studied, Previous_Score, Extracurriculum_Activivities, Sleep_Hours, Sample_Question) |
|
|
|
|
|
|
|
|
if prediction >= 90: |
|
|
st.balloons() |
|
|
st.success(f"๐ **{name}, amazing!** You're on track to score {prediction} marks! Keep up the excellent work! ๐ช") |
|
|
elif prediction >= 35: |
|
|
st.warning(f"โ ๏ธ **{name}, not bad!** You're likely to pass with {prediction} marks, but there's room to aim higher! ๐") |
|
|
else: |
|
|
st.error(f"๐จ **{name}, oh no!** You might score below 35 marks. Consider putting in some more effort! ๐") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|