File size: 24,455 Bytes
e65551b |
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>PneumonAI</title>
<script src="https://cdn.tailwindcss.com"></script>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap"
rel="stylesheet"
/>
<link
rel="icon"
href="{{ url_for('static', filename='logo.png') }}"
type="image/x-icon"
/>
<style>
body {
font-family: "Nunito", sans-serif;
}
.blue {
background-color: #0099ff;
}
.dongker {
color: #01095e;
}
.bg {
background-color: rgba(0, 153, 255, 0.65);
}
.bdr {
border: 2px solid #0099ff;
}
</style>
</head>
<body class="bg-gray-50 text-gray-1000">
<header class="bg-white shadow-lg sticky top-0 z-50">
<div
class="container mx-auto px-12 py-4 flex justify-between items-center"
>
<div class="flex items-center">
<img
alt="PneumonAI logo"
class="h-10 w-10 rounded-md"
height="40"
src="{{ url_for('static', filename='logo.png') }}"
width="40"
/>
<span class="ml-2 text-2xl font-bold dongker"> PneumonAI </span>
</div>
<nav class="flex space-x-4 items-center">
<a class="hover:text-blue-500" href="{{ url_for('home') }}"> Home </a>
<a class="hover:text-blue-500" href="{{ url_for('about') }}">
About Us
</a>
<a
class="blue text-white px-4 py-2 rounded-full hover:bg-blue-500"
href="#detect"
>
Start Detecting
</a>
</nav>
</div>
</header>
<main>
<section class="bg-white py-12">
<div
class="container mx-auto px-12 flex flex-col md:flex-row items-center"
>
<div class="md:w-2/3 text-center md:text-left">
<h1 class="text-5xl font-bold dongker">
Detect Pneumonia with AI. <br />Fast, Accurate, and Easy!
</h1>
<p class="mt-4 pt-4 text-lg">
Welcome to the future of pneumonia detection! With just one click,
you can analyze your chest X-ray and get fast, reliable results.
Start now and experience the power of cutting-edge technology.
</p>
<div class="mt-8 flex justify-center md:justify-start space-x-4">
<a
class="blue text-white px-6 py-3 rounded-full hover:bg-blue-500"
href="#detect"
>
Start Detecting
</a>
</div>
</div>
<div class="md:w-1/3 mt-8 md:mt-0 flex justify-center md:justify-end">
<img
alt="Doctor analyzing X-ray"
class="mx-auto"
height="400"
src="{{ url_for('static', filename='header.png') }}"
width="400"
/>
</div>
</div>
</section>
<section class="bg py-16">
<div class="container mx-auto px-4 py-8">
<h2 class="text-5xl font-bold text-center dongker">
What You Need to Know About Pneumonia
</h2>
<div class="mt-8 grid grid-cols-1 md:grid-cols-2 gap-8 pt-12 px-8">
<div class="bg-white p-6 rounded-2xl shadow">
<h3 class="text-2xl font-bold text-gray-800">
What is Pneumonia?
</h3>
<p class="mt-2">
Pneumonia is a lung infection that makes it hard to breathe. It
fills the air sacs in your lungs with fluid or pus, leading to
coughing, fever, and chills. While anyone can get pneumonia,
it's more dangerous for young kids, older people, and those with
weak immune systems.
</p>
</div>
<div class="bg-white p-6 rounded-2xl shadow">
<h3 class="text-2xl font-bold text-gray-800">What Causes It?</h3>
<p class="mt-2">
Pneumonia is caused by germs like bacteria, viruses (like the
flu or COVID-19), and fungi. The most common type comes from
bacteria called Streptococcus pneumoniae.
</p>
</div>
<div class="bg-white p-6 rounded-2xl shadow">
<h3 class="text-2xl font-bold text-gray-800">
What Happens if It's Left Untreated?
</h3>
<p class="mt-2">
Without treatment, pneumonia can cause serious problems like
breathing failure or blood infections. It's important to treat
it early to prevent these dangers.
</p>
</div>
<div class="bg-white p-6 rounded-2xl shadow">
<h3 class="text-2xl font-bold text-gray-800">
How Do You Detect It?
</h3>
<p class="mt-2">
Pneumonia symptoms can feel like a bad cold, so doctors use
chest X-rays to find it. With our AI, you can upload your X-ray,
and we'll help check for pneumonia quickly.
</p>
</div>
</div>
</div>
</section>
<section class="bg-white py-16 pb-24">
<div class="container mx-auto px-12 pt-8">
<h2 class="text-5xl font-bold text-center dongker">
How Does Our AI Detect Pneumonia?
</h2>
<p class="mt-4 text-center py-8 text-lg">
Behind the scenes, our AI is like a detective, scanning your X-ray
for clues and patterns that could signal pneumonia. It's fast,
reliable, and gives you answers without the wait. Want to know how
it all works? We've got you covered.
</p>
<div class="mt-8 grid grid-cols-1 md:grid-cols-3 gap-8">
<!-- Left column - Powered by Deep Learning Section -->
<div class="bg-white p-6 bdr rounded-3xl shadow-xl">
<div class="flex items-start">
<div>
<img
src="{{ url_for('static', filename='machine-learning.png') }}"
alt="icon"
class="w-9 h-9 mr-4 mb-2"
/>
<h3 class="text-xl font-bold">Powered by Deep Learning</h3>
<p class="mt-2">
Our AI uses deep learning, mimicking the human brain.
Trained on thousands of X-rays, it recognizes subtle
patterns that even experts might miss, like having a
super-experienced radiologist 24/7.
</p>
</div>
</div>
</div>
<!-- Center Column - Robot Image Section -->
<div
class="bg-white p-6 bdr rounded-3xl shadow-xl row-span-2 flex items-center justify-center"
>
<img
alt="AI analyzing X-ray"
class="mx-auto"
height="500"
src="{{ url_for('static', filename='robot.png') }}"
width="500"
/>
</div>
<!-- Left column - Super Quick Results Section -->
<div class="bg-white p-6 bdr rounded-3xl shadow-xl">
<div class="flex items-start">
<div>
<img
src="{{ url_for('static', filename='clock.png') }}"
alt="icon"
class="w-9 h-9 mr-4 mb-2"
/>
<h3 class="text-xl font-bold">Super Quick Results</h3>
<p class="mt-2">
Get results in seconds after uploading your image. The AI
processes it instantly, delivering a detailed report without
delay.
</p>
</div>
</div>
</div>
<!-- Right column - What Does It Look For? Section -->
<div class="bg-white p-6 bdr rounded-3xl shadow-xl">
<div class="flex items-start">
<div>
<img
src="{{ url_for('static', filename='eye.png') }}"
alt="icon"
class="w-9 h-9 mr-4 mb-2"
/>
<h3 class="text-xl font-bold">What Does It Look For?</h3>
<p class="mt-2">
Upload your chest X-ray, and the AI scans for pneumonia
signs such as lung opacity, fluid buildup, and inflammation,
providing a detailed analysis.
</p>
</div>
</div>
</div>
<!-- Right column - Accuracy You Can Trust Section -->
<div class="bg-white p-6 bdr rounded-3xl shadow-xl">
<div class="flex items-start">
<div>
<img
src="{{ url_for('static', filename='accuracy.png') }}"
alt="icon"
class="w-9 h-9 mr-4 mb-2"
/>
<h3 class="text-xl font-bold">Accuracy You Can Trust</h3>
<p class="mt-2">
Trained on 10,000 images, our model delivers 95.83% of
accuracy, complementing doctors' expertise for the best
care.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="bg py-16 px-8 pb-24" id="detect">
<div class="container mx-auto px-4 text-center">
<h2 class="text-5xl font-bold dongker mt-8">
Upload Your X-ray - Get Instant Results!
</h2>
<p class="mt-4 text-lg py-8">
Got a chest X-ray? Great! Upload it here, and in just a few moments,
our AI will give you a detailed report. <br />It's quick, it's easy,
and it's secure. Let's get started!
</p>
<div
class="mt-8 grid grid-cols-1 md:grid-cols-2 gap-8 bg-white rounded-3xl p-8 mx-36"
style="min-height: 450px"
>
<div
class="bg-white p-6 rounded-xl shadow flex flex-col items-center justify-center border-2 border-dashed border-gray-500 relative"
>
<img
src="{{ url_for('static', filename='x-ray.png') }}"
alt="icon"
class="w-20 h-20 opacity-40"
id="uploadLogo"
/>
<button
class="mt-4 blue text-white px-6 py-3 mt-8 rounded-full hover:bg-blue-500"
id="uploadButton"
>
Upload Image
</button>
<input
class="hidden"
id="fileInput"
type="file"
accept="image/*"
/>
<img
alt="Image Preview"
class="mt-4 hidden"
id="imagePreview"
style="display: none; max-width: 100%"
/>
<i
class="fas fa-times text-3xl absolute dongker mt-4 hidden top-0 right-6"
id="removeImage"
style="cursor: pointer"
>
</i>
</div>
<div
class="bg-white p-6 rounded-xl shadow flex flex-col items-center justify-center border-2 border-gray-300"
>
<img
src="{{ url_for('static', filename='loupe.png') }}"
alt="icon"
class="w-20 h-20 opacity-40"
id="check-icon"
/>
<button
class="mt-4 bg-gray-200 px-6 py-3 mt-8 rounded-full hover:bg-gray-300"
id="check-button"
disabled
>
Check My X-Ray
</button>
<div class="w-full" id="prediction-result" style="display: none">
<div>
<p class="text-left pb-2 text-lg">Prediction</p>
<div
id="prediction"
class="bg-gray-100 py-9 rounded-lg text-center text-2xl font-bold"
>
Pneumonia
</div>
</div>
<div class="pt-12">
<p class="text-left pb-2 text-lg">Confidence</p>
<div
id="confidence"
class="bg-gray-100 py-9 rounded-lg text-center text-2xl font-bold"
>
98.57%
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="bg-white py-16 px-8">
<div class="container mx-auto px-4">
<h2 class="text-5xl font-bold dongker">Frequently Ask Question</h2>
<hr class="my-4 border-t-2 border-gray-300" />
<ul class="mt-8 space-y-4 text-lg">
<li class="accordion-item">
<div class="accordion-header cursor-pointer text-xl font-bold">
<span class="icon font-normal">></span>
<span>How quickly can I start the detection process?</span>
</div>
<div
class="accordion-content max-h-0 overflow-hidden transition-all duration-300"
>
<p class="mt-2 text-justify">
No complicated forms here. Just drag and drop your chest X-ray
image or select it from your device, and our AI will start
analyzing right away. The process only takes a few seconds,
and you'll have your results in no time.
</p>
</div>
</li>
<li class="accordion-item">
<div class="accordion-header cursor-pointer text-xl font-bold">
<span class="icon font-normal">></span>
<span>What information will I receive after the scan?</span>
</div>
<div
class="accordion-content max-h-0 overflow-hidden transition-all duration-300"
>
<p class="mt-2 text-justify">
Once the scan is complete, you’ll receive two key pieces of
information:
<br /><br />
Prediction: Whether the scan indicates ‘Normal’ or shows signs
of ‘Pneumonia’.
<br />
Confidence Level: A percentage that tells you how confident
the AI is in its prediction.
<br /><br />
For example, a 95% confidence means the AI is highly certain
about its result.
</p>
</div>
</li>
<li class="accordion-item">
<div class="accordion-header cursor-pointer text-xl font-bold">
<span class="icon font-normal">></span>
<span>Is my privacy protected when using this tool?</span>
</div>
<div
class="accordion-content max-h-0 overflow-hidden transition-all duration-300"
>
<p class="mt-2 text-justify">
We take your privacy seriously. Your X-rays are processed
securely, and we don’t store any images after generating your
results. It’s all about keeping your data safe while giving
you the answers you need.
</p>
</div>
</li>
<li class="accordion-item">
<div class="accordion-header cursor-pointer text-xl font-bold">
<span class="icon font-normal">></span>
<span>How fast will I get the results?</span>
</div>
<div
class="accordion-content max-h-0 overflow-hidden transition-all duration-300"
>
<p class="mt-2 text-justify">
No need to wait around. As soon as the image is uploaded, our
AI works its magic and provides you with a detailed prediction
in seconds. The confidence score helps you understand how
reliable the result is, giving you peace of mind.
</p>
</div>
</li>
<li class="accordion-item">
<div class="accordion-header cursor-pointer text-xl font-bold">
<span class="icon font-normal">></span>
<span>What should I do if the result indicates pneumonia?</span>
</div>
<div
class="accordion-content max-h-0 overflow-hidden transition-all duration-300"
>
<p class="mt-2 text-justify">
If the result suggests pneumonia, we recommend you follow up
with a healthcare professional. The AI is designed to support
early detection, but a doctor’s opinion is always the next
step in your care journey.
</p>
</div>
</li>
</ul>
</div>
</section>
</main>
<footer class="bg-white py-4 pb-4">
<div class="container mx-auto px-4 text-center">
<p>Copyright © 2024 PneumonAI</p>
</div>
</footer>
<script>
document.addEventListener("DOMContentLoaded", function () {
const items = document.querySelectorAll(".accordion-item");
items.forEach((item) => {
item
.querySelector(".accordion-header")
.addEventListener("click", () => {
const openItem = document.querySelector(".accordion-item.open");
toggleItem(item);
if (openItem && openItem !== item) {
toggleItem(openItem);
}
});
});
const toggleItem = (item) => {
const content = item.querySelector(".accordion-content");
if (item.classList.contains("open")) {
content.style.maxHeight = null;
item.classList.remove("open");
} else {
content.style.maxHeight = content.scrollHeight + "px";
item.classList.add("open");
}
};
document
.getElementById("uploadButton")
.addEventListener("click", function () {
document.getElementById("fileInput").click();
});
document
.getElementById("fileInput")
.addEventListener("change", function (event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
document.getElementById("imagePreview").src = e.target.result;
document.getElementById("imagePreview").style.display = "block";
document.getElementById("uploadLogo").style.display = "none";
document.getElementById("uploadButton").style.display = "none";
document.getElementById("removeImage").style.display = "block";
};
reader.readAsDataURL(file);
}
});
document
.getElementById("removeImage")
.addEventListener("click", function () {
document.getElementById("fileInput").value = "";
document.getElementById("imagePreview").style.display = "none";
document.getElementById("uploadLogo").style.display = "block";
document.getElementById("uploadButton").style.display = "block";
document.getElementById("removeImage").style.display = "none";
// sementara - handle upload tapi blm dicheck dan lgsg remove
window.location.reload();
});
});
document.querySelectorAll(".accordion-item").forEach((item) => {
const header = item.querySelector(".accordion-header");
const content = item.querySelector(".accordion-content");
const icon = header.querySelector(".icon");
header.addEventListener("click", () => {
const isActive = content.style.maxHeight;
document
.querySelectorAll(".accordion-content")
.forEach((c) => (c.style.maxHeight = null));
document
.querySelectorAll(".icon")
.forEach((i) => (i.textContent = ">"));
if (!isActive) {
content.style.maxHeight = content.scrollHeight + "px";
icon.textContent = "v";
} else {
content.style.maxHeight = null;
}
});
});
const fileInput = document.getElementById("fileInput");
const checkButton = document.getElementById("check-button");
const removeImage = document.getElementById("removeImage");
const uploadLogo = document.getElementById("uploadLogo");
const imagePreview = document.getElementById("imagePreview");
const predictionResult = document.getElementById("prediction-result");
const predictionText = document.getElementById("prediction");
const confidenceText = document.getElementById("confidence");
// Enable the check button when an image is uploaded
fileInput.addEventListener("change", function () {
if (fileInput.files.length > 0) {
checkButton.disabled = false;
uploadLogo.classList.add("hidden"); // Hide the upload icon
imagePreview.src = URL.createObjectURL(fileInput.files[0]);
imagePreview.classList.remove("hidden"); // Show the image preview
removeImage.classList.remove("hidden"); // Show the remove icon
} else {
checkButton.disabled = true;
}
});
// Call the showPrediction function when the "Check" button is clicked
checkButton.addEventListener("click", function () {
const formData = new FormData();
formData.append("file", fileInput.files[0]);
console.log(formData);
fetch("/predict", {
// Ensure '/predict' matches your Flask route
method: "POST",
body: formData,
})
.then((response) => response.json())
.then((data) => {
predictionText.innerText = data.prediction; // Update with the prediction result
confidenceText.innerText = data.confidence.toFixed(2) + "%"; // Update with the confidence
predictionResult.style.display = "block"; // Show the prediction result
document.getElementById("check-icon").style.display = "none";
document.getElementById("check-button").style.display = "none";
})
.catch((error) => {
console.error("Error:", error);
});
});
removeImage.addEventListener("click", function () {
fileInput.value = ""; // Clear the file input
checkButton.disabled = true; // Disable the check button
uploadLogo.classList.remove("hidden"); // Show the upload icon again
imagePreview.classList.add("hidden"); // Hide the image preview
removeImage.classList.add("hidden"); // Hide the remove icon
predictionResult.style.display = "none"; // Hide the prediction result
});
</script>
</body>
</html>
|