File size: 1,916 Bytes
98f12ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import numpy as np
import joblib
import streamlit as st

#loading the model
model = joblib.load("performance.h5")

def predict_marks(Hours_Studied,Previous_Scores,Extracurricular_Activities,Sleep_Hours,Sample_Question_Papers_Practiced):
    "predict the student marks based on the input data"
    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 marks")

    # input data    
    Hours_Studied = st.number_input("Enter no. of Hours you studied",min_value=0.0,max_value=10.0,value=0.0)
    Previous_Scores = st.number_input("Enter your previous exam score",min_value=0.0,max_value=100.0,value=0.0)
    Extracurricular_Activities = st.number_input("Enter your Extra activities",min_value=0.0,max_value=10.0,value=0.0)
    Sleep_Hours = st.number_input("Enter no. of hours you slept",min_value=0.0,max_value=12.0,value=0.0)
    Sample_Question_Papers_Practiced = st.number_input("Enter no. of sample questions you practiced",min_value=0.0,max_value=50.0,value=0.0)

    if st.button("Predict your marks"):
        prediction = predict_marks(Hours_Studied,Previous_Scores,Extracurricular_Activities,Sleep_Hours,Sample_Question_Papers_Practiced)

        #Displat the result
        if prediction >=90:
            st.balloons()
            st.success(f"Congralution you have high chances to pass by {prediction} marks")
        elif prediction>=35:
            st.warning(f"you have to work hard you have chances to score with {prediction} marks")
        else:
            st.error(f"you have high chances of failing with {prediction} marks")        

if __name__ == "__main__":
    main()