File size: 2,229 Bytes
ee66b65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
    <title>Student Performance Prediction</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

<div class="container">
<h2>Student Performance Prediction</h2>

<label>Hours Studied:</label>
<input type="number" id="Hours_Studied">

<label>Attendance (%):</label>
<input type="number" id="Attendance">

<label>Previous Score:</label>
<input type="number" id="Previous_Scores">

<label>Sleep Hours:</label>
<input type="number" id="Sleep_Hours">

<label>Motivation Level (0–Low, 1–Medium, 2–High):</label>
<input type="number" id="Motivation_Level">

<label>Internet Access (0–No, 1–Yes):</label>
<input type="number" id="Internet_Access">

<label>Gender (0–Female, 1–Male):</label>
<input type="number" id="Gender">

<button onclick="predict()">Predict Exam Score</button>

<p id="result"></p>
</div>

<script>

function predict() {

    document.getElementById("result").innerText = "Predicting...";



    fetch("http://127.0.0.1:5000/predict", {

        method: "POST",

        headers: {

            "Content-Type": "application/json"

        },

        body: JSON.stringify({

            "Hours_Studied": Number(Hours_Studied.value),

            "Attendance": Number(Attendance.value),

            "Parental_Involvement": 2,

            "Access_to_Resources": 2,

            "Extracurricular_Activities": 1,

            "Sleep_Hours": Number(Sleep_Hours.value),

            "Previous_Scores": Number(Previous_Scores.value),

            "Motivation_Level": Number(Motivation_Level.value),

            "Internet_Access": Number(Internet_Access.value),

            "Tutoring_Sessions": 1,

            "Family_Income": 2,

            "Teacher_Quality": 2,

            "School_Type": 1,

            "Peer_Influence": 1,

            "Physical_Activity": 1,

            "Learning_Disabilities": 0,

            "Parental_Education_Level": 2,

            "Distance_from_Home": 5,

            "Gender": Number(Gender.value)

        })

    })

    .then(res => res.json())

    .then(data => {

        result.innerText = "Predicted Exam Score: " + data.predicted_score;

    });

}

</script>

</body>
</html>