|
|
import streamlit as st
|
|
|
import pandas as pd
|
|
|
import numpy as np
|
|
|
import joblib
|
|
|
|
|
|
|
|
|
model = joblib.load('student_performance_model.h5')
|
|
|
|
|
|
def predict_marks(Hours_Studied,Previous_Scores,Extracurricular_Activities,Sleep_Hours,Sample_Question_Papers_Practiced):
|
|
|
input_data = np.array([[Hours_Studied,Previous_Scores,Extracurricular_Activities,Sleep_Hours,Sample_Question_Papers_Practiced]])
|
|
|
prediction = model.predict(input_data)
|
|
|
prediction = round(float(prediction), 2)
|
|
|
|
|
|
if prediction >= 100:
|
|
|
prediction = 100
|
|
|
|
|
|
return prediction
|
|
|
|
|
|
|
|
|
def main():
|
|
|
st.title("Student Performance Prediction")
|
|
|
name = st.text_input("Enter your name:--")
|
|
|
Hours_Studied = st.number_input("Enter Number of hours you daily study:--",max_value=12,min_value=0,value=0)
|
|
|
Previous_Scores = st.number_input("Enter your previous scores:--",max_value=100.0,min_value=0.0,value=0.0)
|
|
|
Extracurricular_Activities = st.number_input("Enter the number of extracurricular activities you participate in:--",max_value=10,min_value=0,value=0)
|
|
|
Sleep_Hours= st.number_input("Enter the number of hours you sleep daily:--",max_value=12,min_value=0,value=0)
|
|
|
Sample_Question_Papers_Practiced= st.number_input("Enter the number of sample question papers you practice:--",max_value=100,min_value=0,value=0)
|
|
|
|
|
|
st.sidebar.title("Prediction")
|
|
|
st.sidebar.write(f"Hey, {name}")
|
|
|
|
|
|
if st.button("Result"):
|
|
|
prediction = predict_marks(Hours_Studied,Previous_Scores,Extracurricular_Activities,Sleep_Hours,Sample_Question_Papers_Practiced)
|
|
|
if prediction > 90:
|
|
|
st.success(f"Your predicted grade is A you are on a correct path with the estimated score of {prediction}.")
|
|
|
st.balloons()
|
|
|
elif prediction > 35:
|
|
|
st.warning(f"Your predicted grade is B you need to impove your estimated score is {prediction}.")
|
|
|
else:
|
|
|
st.error(f"Work hard your estimated score is {prediction}.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
main()
|
|
|
|
|
|
|