SURESHBEEKHANI
commited on
Upload 4 files
Browse files- static/img/bg.jpg +0 -0
- static/img/ht.png +0 -0
- static/styles.css +166 -0
- templates/index.html +181 -0
static/img/bg.jpg
ADDED
static/img/ht.png
ADDED
static/styles.css
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Base Styles */
|
2 |
+
body {
|
3 |
+
font-family: 'Roboto', sans-serif;
|
4 |
+
background: url('static/img/bg.jpg') no-repeat center center fixed;
|
5 |
+
background-size: cover;
|
6 |
+
margin: 0;
|
7 |
+
padding: 0;
|
8 |
+
color: #333;
|
9 |
+
}
|
10 |
+
|
11 |
+
/* Header Styles */
|
12 |
+
header {
|
13 |
+
background-color: #007bff; /* Primary color */
|
14 |
+
color: #fff;
|
15 |
+
padding: 2rem 0;
|
16 |
+
text-align: center;
|
17 |
+
position: relative;
|
18 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
19 |
+
}
|
20 |
+
|
21 |
+
header .logo {
|
22 |
+
max-width: 100px;
|
23 |
+
margin-bottom: 1rem;
|
24 |
+
}
|
25 |
+
|
26 |
+
/* Main Section */
|
27 |
+
main {
|
28 |
+
padding: 2rem 0;
|
29 |
+
}
|
30 |
+
|
31 |
+
.container {
|
32 |
+
max-width: 600px; /* Centering the form */
|
33 |
+
margin: 0 auto;
|
34 |
+
padding: 0 1rem;
|
35 |
+
}
|
36 |
+
|
37 |
+
/* Section Title */
|
38 |
+
h3 {
|
39 |
+
font-size: 1.8rem;
|
40 |
+
margin-bottom: 1.5rem;
|
41 |
+
text-align: center;
|
42 |
+
color: #007bff;
|
43 |
+
}
|
44 |
+
|
45 |
+
/* Form Styles */
|
46 |
+
form {
|
47 |
+
background: linear-gradient(to bottom right, rgba(6, 142, 253, 0.9), rgba(240, 240, 240, 0.9));
|
48 |
+
padding: 2.5rem;
|
49 |
+
border-radius: 10px;
|
50 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
|
51 |
+
transition: transform 0.3s;
|
52 |
+
max-width: 600px;
|
53 |
+
width: 100%;
|
54 |
+
margin: 0 auto;
|
55 |
+
}
|
56 |
+
|
57 |
+
form:hover {
|
58 |
+
transform: translateY(-5px);
|
59 |
+
}
|
60 |
+
|
61 |
+
/* Form Inputs */
|
62 |
+
.form-group label {
|
63 |
+
font-weight: 600;
|
64 |
+
margin-bottom: 0.5rem;
|
65 |
+
display: block; /* Ensure labels are block-level */
|
66 |
+
}
|
67 |
+
|
68 |
+
.form-control {
|
69 |
+
border-radius: 5px;
|
70 |
+
font-size: 1rem;
|
71 |
+
padding: 0.75rem;
|
72 |
+
border: 1px solid #ccc;
|
73 |
+
transition: border-color 0.3s, box-shadow 0.3s;
|
74 |
+
background: #fff; /* White background for inputs */
|
75 |
+
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
|
76 |
+
}
|
77 |
+
|
78 |
+
.form-control:focus {
|
79 |
+
border-color: #007bff;
|
80 |
+
box-shadow: 0 0 8px rgba(0, 123, 255, 0.25), inset 0 2px 5px rgba(0, 0, 0, 0.1);
|
81 |
+
outline: none;
|
82 |
+
}
|
83 |
+
|
84 |
+
/* Input Placeholder Styling */
|
85 |
+
.form-control::placeholder {
|
86 |
+
color: #999; /* Light gray for placeholder */
|
87 |
+
font-style: italic; /* Italicize the placeholder text */
|
88 |
+
}
|
89 |
+
|
90 |
+
/* Submit Button */
|
91 |
+
.btn-primary {
|
92 |
+
font-size: 1.2rem;
|
93 |
+
font-weight: 700;
|
94 |
+
padding: 0.75rem 1.5rem;
|
95 |
+
border-radius: 5px;
|
96 |
+
width: 100%;
|
97 |
+
transition: background-color 0.3s, transform 0.3s;
|
98 |
+
background-color: #007bff;
|
99 |
+
border: none;
|
100 |
+
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.25);
|
101 |
+
}
|
102 |
+
|
103 |
+
.btn-primary:hover {
|
104 |
+
background-color: #0056b3;
|
105 |
+
transform: translateY(-2px);
|
106 |
+
}
|
107 |
+
|
108 |
+
/* Prediction Result Styles */
|
109 |
+
.prediction-result {
|
110 |
+
background-color: rgba(255, 255, 255, 0.9); /* White background with slight transparency */
|
111 |
+
border-radius: 15px; /* Rounded corners */
|
112 |
+
padding: 20px; /* Add padding for spacing */
|
113 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
|
114 |
+
margin-top: 30px; /* Space above */
|
115 |
+
width: 100%;
|
116 |
+
}
|
117 |
+
|
118 |
+
.result-title {
|
119 |
+
font-size: 24px; /* Larger font size for the title */
|
120 |
+
font-weight: bold; /* Bold text */
|
121 |
+
margin-bottom: 10px; /* Space below title */
|
122 |
+
}
|
123 |
+
|
124 |
+
.result-value {
|
125 |
+
font-size: 18px; /* Font size for result */
|
126 |
+
color: #007bff; /* Use primary color for emphasis */
|
127 |
+
font-weight: 700; /* Bold font weight */
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
/* Footer Styles */
|
132 |
+
footer {
|
133 |
+
background-color: #007bff;
|
134 |
+
color: #fff;
|
135 |
+
text-align: center;
|
136 |
+
padding: 1rem;
|
137 |
+
margin-top: 2rem;
|
138 |
+
}
|
139 |
+
|
140 |
+
footer p {
|
141 |
+
margin: 0;
|
142 |
+
font-size: 1rem;
|
143 |
+
}
|
144 |
+
|
145 |
+
/* Responsive Design */
|
146 |
+
@media (max-width: 768px) {
|
147 |
+
header h1 {
|
148 |
+
font-size: 2rem;
|
149 |
+
}
|
150 |
+
|
151 |
+
header p {
|
152 |
+
font-size: 1rem;
|
153 |
+
}
|
154 |
+
|
155 |
+
.container {
|
156 |
+
padding: 0 0.5rem; /* Reduced padding for smaller screens */
|
157 |
+
}
|
158 |
+
|
159 |
+
.btn-primary {
|
160 |
+
font-size: 1rem; /* Slightly smaller button on small screens */
|
161 |
+
}
|
162 |
+
|
163 |
+
h3 {
|
164 |
+
font-size: 1.5rem; /* Smaller section title on small screens */
|
165 |
+
}
|
166 |
+
}
|
templates/index.html
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<meta charset="UTF-8">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<meta name="description" content="Heart Attack Prediction Tool - Predict your risk of heart attack using medical data.">
|
8 |
+
<title>Heart Attack Prediction</title>
|
9 |
+
<link rel="icon" href="static/img/ht.jpg" type="image/x-icon">
|
10 |
+
|
11 |
+
<!-- Google Fonts -->
|
12 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
13 |
+
|
14 |
+
<!-- Custom Stylesheet -->
|
15 |
+
<link rel="stylesheet" href="static/styles.css">
|
16 |
+
|
17 |
+
<!-- Bootstrap CSS -->
|
18 |
+
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
19 |
+
</head>
|
20 |
+
|
21 |
+
<body>
|
22 |
+
<header class="bg-primary text-white text-center py-3">
|
23 |
+
<img src="static/img/ht.png" alt="Heart Health Logo" class="logo" style="max-width: 100px;">
|
24 |
+
<h1>Heart Attack Prediction</h1>
|
25 |
+
<p>Predict heart attack risk using an AI application Provide Details of Patient.</p>
|
26 |
+
</header>
|
27 |
+
|
28 |
+
<main>
|
29 |
+
<div class="container">
|
30 |
+
<form action="/predict" method="post" class="needs-validation" novalidate>
|
31 |
+
<!-- Sex Selection -->
|
32 |
+
<div class="form-group">
|
33 |
+
<label for="sex">Sex:</label>
|
34 |
+
<select id="sex" name="sex" class="form-control" required aria-label="Select your sex">
|
35 |
+
<option value="" disabled selected>Select your sex</option>
|
36 |
+
<option value="M">Male</option>
|
37 |
+
<option value="F">Female</option>
|
38 |
+
</select>
|
39 |
+
<div class="invalid-feedback">Please select your sex.</div>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<!-- Chest Pain Type -->
|
43 |
+
<div class="form-group">
|
44 |
+
<label for="chestPainType">Chest Pain Type:</label>
|
45 |
+
<select id="chestPainType" name="chestPainType" class="form-control" required aria-label="Select chest pain type">
|
46 |
+
<option value="" disabled selected>Select chest pain type</option>
|
47 |
+
<option value="ATA">ATA</option>
|
48 |
+
<option value="NAP">NAP</option>
|
49 |
+
<option value="ASY">ASY</option>
|
50 |
+
<option value="TA">TA</option>
|
51 |
+
</select>
|
52 |
+
<div class="invalid-feedback">Please select chest pain type.</div>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<!-- Resting ECG -->
|
56 |
+
<div class="form-group">
|
57 |
+
<label for="restingECG">Resting ECG:</label>
|
58 |
+
<select id="restingECG" name="restingECG" class="form-control" required aria-label="Select resting ECG result">
|
59 |
+
<option value="" disabled selected>Select resting ECG result</option>
|
60 |
+
<option value="Normal">Normal</option>
|
61 |
+
<option value="ST">ST</option>
|
62 |
+
<option value="LVH">LVH</option>
|
63 |
+
</select>
|
64 |
+
<div class="invalid-feedback">Please select resting ECG.</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<!-- Exercise Angina -->
|
68 |
+
<div class="form-group">
|
69 |
+
<label for="exerciseAngina">Exercise Angina:</label>
|
70 |
+
<select id="exerciseAngina" name="exerciseAngina" class="form-control" required aria-label="Select exercise angina">
|
71 |
+
<option value="" disabled selected>Select exercise angina</option>
|
72 |
+
<option value="N">No</option>
|
73 |
+
<option value="Y">Yes</option>
|
74 |
+
</select>
|
75 |
+
<div class="invalid-feedback">Please select exercise angina.</div>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<!-- ST Slope -->
|
79 |
+
<div class="form-group">
|
80 |
+
<label for="stSlope">ST Slope:</label>
|
81 |
+
<select id="stSlope" name="stSlope" class="form-control" required aria-label="Select ST slope">
|
82 |
+
<option value="" disabled selected>Select ST slope</option>
|
83 |
+
<option value="Up">Up</option>
|
84 |
+
<option value="Flat">Flat</option>
|
85 |
+
<option value="Down">Down</option>
|
86 |
+
</select>
|
87 |
+
<div class="invalid-feedback">Please select ST slope.</div>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<!-- Age -->
|
91 |
+
<div class="form-group">
|
92 |
+
<label for="age">Age:</label>
|
93 |
+
<input type="number" id="age" name="age" class="form-control" required min="0" placeholder="Enter your age" aria-label="Enter your age">
|
94 |
+
<div class="invalid-feedback">Please enter a valid age.</div>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<!-- Resting Blood Pressure -->
|
98 |
+
<div class="form-group">
|
99 |
+
<label for="restingBP">Resting Blood Pressure (mm Hg):</label>
|
100 |
+
<input type="number" id="restingBP" name="restingBP" class="form-control" required min="0" placeholder="Enter resting blood pressure" aria-label="Enter resting blood pressure">
|
101 |
+
<div class="invalid-feedback">Please enter resting blood pressure.</div>
|
102 |
+
</div>
|
103 |
+
|
104 |
+
<!-- Cholesterol -->
|
105 |
+
<div class="form-group">
|
106 |
+
<label for="cholesterol">Cholesterol (mg/dl):</label>
|
107 |
+
<input type="number" id="cholesterol" name="cholesterol" class="form-control" required min="0" placeholder="Enter cholesterol level" aria-label="Enter cholesterol level">
|
108 |
+
<div class="invalid-feedback">Please enter cholesterol level.</div>
|
109 |
+
</div>
|
110 |
+
|
111 |
+
<!-- Fasting Blood Sugar -->
|
112 |
+
<div class="form-group">
|
113 |
+
<label for="fastingBS">Fasting Blood Sugar (mg/dl):</label>
|
114 |
+
<input type="number" id="fastingBS" name="fastingBS" class="form-control" required min="0" placeholder="Enter fasting blood sugar" aria-label="Enter fasting blood sugar">
|
115 |
+
<div class="invalid-feedback">Please enter fasting blood sugar.</div>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<!-- Max Heart Rate -->
|
119 |
+
<div class="form-group">
|
120 |
+
<label for="maxHR">Max Heart Rate:</label>
|
121 |
+
<input type="number" id="maxHR" name="maxHR" class="form-control" required min="0" placeholder="Enter max heart rate" aria-label="Enter max heart rate">
|
122 |
+
<div class="invalid-feedback">Please enter max heart rate.</div>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
<!-- Oldpeak -->
|
126 |
+
<div class="form-group">
|
127 |
+
<label for="oldpeak">Oldpeak:</label>
|
128 |
+
<input type="number" id="oldpeak" name="oldpeak" class="form-control" required step="0.1" min="0" placeholder="Enter oldpeak value" aria-label="Enter oldpeak value">
|
129 |
+
<div class="invalid-feedback">Please enter a valid oldpeak value.</div>
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<!-- Submit Button -->
|
133 |
+
<div class="text-center">
|
134 |
+
<input class="btn btn-primary btn-lg" type="submit" value="Predict Risk of Heart Attack" />
|
135 |
+
</div>
|
136 |
+
</form>
|
137 |
+
|
138 |
+
<!-- Display prediction result -->
|
139 |
+
{% if results %}
|
140 |
+
<div class="alert alert-info mt-4 text-center prediction-result">
|
141 |
+
<h2 class="result-title">The prediction is:</h2>
|
142 |
+
<p class="result-value">{{ results }}</p>
|
143 |
+
</div>
|
144 |
+
{% endif %}
|
145 |
+
</div>
|
146 |
+
</main>
|
147 |
+
|
148 |
+
<footer class="text-center py-3">
|
149 |
+
<p>© <span id="year"></span> Heart Health Initiative</p>
|
150 |
+
</footer>
|
151 |
+
|
152 |
+
<!-- Include Bootstrap JS for form validation -->
|
153 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
154 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
155 |
+
|
156 |
+
<!-- Dynamic Year Update -->
|
157 |
+
<script>
|
158 |
+
document.getElementById("year").textContent = new Date().getFullYear();
|
159 |
+
</script>
|
160 |
+
|
161 |
+
<!-- Bootstrap Form Validation -->
|
162 |
+
<script>
|
163 |
+
(function() {
|
164 |
+
'use strict';
|
165 |
+
window.addEventListener('load', function() {
|
166 |
+
var forms = document.getElementsByClassName('needs-validation');
|
167 |
+
var validation = Array.prototype.filter.call(forms, function(form) {
|
168 |
+
form.addEventListener('submit', function(event) {
|
169 |
+
if (form.checkValidity() === false) {
|
170 |
+
event.preventDefault();
|
171 |
+
event.stopPropagation();
|
172 |
+
}
|
173 |
+
form.classList.add('was-validated');
|
174 |
+
}, false);
|
175 |
+
});
|
176 |
+
}, false);
|
177 |
+
})();
|
178 |
+
</script>
|
179 |
+
</body>
|
180 |
+
|
181 |
+
</html>
|