File size: 2,108 Bytes
b77ed8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
import pandas as pd 
import numpy as np
import joblib

# Load the trained model    
model = joblib.load('student_performance_model.h5')
# Define the input features
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

# Display the app title
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()