Spaces:
Running
Running
GOWREESH M G commited on
Update templates/index.html
Browse files- templates/index.html +48 -23
templates/index.html
CHANGED
|
@@ -41,11 +41,12 @@
|
|
| 41 |
--bg-grad-end: #050505;
|
| 42 |
--text-main: #f3e8ff;
|
| 43 |
--text-secondary: #c084fc;
|
| 44 |
-
|
| 45 |
-
--glass-
|
|
|
|
| 46 |
--glass-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
|
| 47 |
--icon-vibrant: #d946ef;
|
| 48 |
-
--btn-bg: rgba(255, 255, 255, 0.
|
| 49 |
}
|
| 50 |
|
| 51 |
body {
|
|
@@ -109,7 +110,7 @@
|
|
| 109 |
/* Interactive Islands */
|
| 110 |
.inner-btn {
|
| 111 |
background: var(--btn-bg);
|
| 112 |
-
border: 1px solid rgba(255, 255, 255, 0.
|
| 113 |
border-radius: 2.2rem;
|
| 114 |
padding: 1.6rem;
|
| 115 |
display: flex;
|
|
@@ -127,14 +128,14 @@
|
|
| 127 |
}
|
| 128 |
|
| 129 |
[data-theme="dark"] .inner-btn:hover:not(.disabled) {
|
| 130 |
-
background: rgba(255, 255, 255, 0.
|
| 131 |
box-shadow: 0 15px 35px rgba(217, 70, 239, 0.2);
|
| 132 |
}
|
| 133 |
|
| 134 |
.inner-btn:active:not(.disabled) { transform: scale(0.96) translateY(0); }
|
| 135 |
.inner-btn.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
|
| 136 |
|
| 137 |
-
/* Vibrant Icons
|
| 138 |
.icon-vibrant { transition: all 0.4s ease; }
|
| 139 |
.icon-purple { color: #6d28d9; }
|
| 140 |
.icon-pink { color: #db2777; }
|
|
@@ -160,6 +161,10 @@
|
|
| 160 |
color: var(--text-secondary);
|
| 161 |
backdrop-filter: blur(10px);
|
| 162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
.status-dot {
|
| 165 |
width: 8px;
|
|
@@ -185,6 +190,13 @@
|
|
| 185 |
background-clip: text;
|
| 186 |
animation: shimmer 4s linear infinite;
|
| 187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
@keyframes shimmer { to { background-position: 200% center; } }
|
| 190 |
|
|
@@ -299,7 +311,7 @@
|
|
| 299 |
</h1>
|
| 300 |
<div class="status-badge">
|
| 301 |
<span class="status-dot"></span>
|
| 302 |
-
AI
|
| 303 |
</div>
|
| 304 |
</div>
|
| 305 |
</div>
|
|
@@ -334,7 +346,7 @@
|
|
| 334 |
|
| 335 |
<!-- FOOTER -->
|
| 336 |
<footer class="mt-auto pt-8 text-center opacity-40">
|
| 337 |
-
<p class="text-[10px] font-mono uppercase tracking-widest">Powered by
|
| 338 |
</footer>
|
| 339 |
|
| 340 |
<!-- SCANNING SECTION (Initially Hidden) -->
|
|
@@ -370,16 +382,20 @@
|
|
| 370 |
<h2 id="result-diagnosis" class="text-3xl font-bold mb-1 text-center tracking-tight">--</h2>
|
| 371 |
<p id="result-severity" class="sub-label text-purple-600 dark:text-purple-400 mb-4 font-black text-xs">ANALYSIS COMPLETE</p>
|
| 372 |
|
| 373 |
-
<p id="result-desc" class="text-sm opacity-70 mb-
|
| 374 |
|
| 375 |
-
<
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
</div>
|
| 384 |
</div>
|
| 385 |
|
|
@@ -577,10 +593,6 @@
|
|
| 577 |
|
| 578 |
const ctx = canvas.getContext('2d');
|
| 579 |
|
| 580 |
-
// Optional: Flip horizontally if using front camera (not the case here with 'environment')
|
| 581 |
-
// ctx.translate(canvas.width, 0);
|
| 582 |
-
// ctx.scale(-1, 1);
|
| 583 |
-
|
| 584 |
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| 585 |
|
| 586 |
canvas.toBlob(blob => {
|
|
@@ -631,7 +643,7 @@
|
|
| 631 |
const steps = [
|
| 632 |
{ s: "Preprocessing", d: "Isolating Green Channel...", w: "30%" },
|
| 633 |
{ s: "Segmentation", d: "Mapping Vascular Geometry...", w: "65%" },
|
| 634 |
-
{ s: "AI Processing", d: "EfficientNet
|
| 635 |
{ s: "Finalizing", d: "Generating Diagnosis...", w: "100%" }
|
| 636 |
];
|
| 637 |
steps.forEach((step, i) => {
|
|
@@ -657,7 +669,20 @@
|
|
| 657 |
document.getElementById('result-severity').textContent = data.severity;
|
| 658 |
document.getElementById('result-desc').textContent = data.description;
|
| 659 |
document.getElementById('result-conf').textContent = data.confidence;
|
| 660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 661 |
lucide.createIcons();
|
| 662 |
switchView('view-result');
|
| 663 |
}
|
|
|
|
| 41 |
--bg-grad-end: #050505;
|
| 42 |
--text-main: #f3e8ff;
|
| 43 |
--text-secondary: #c084fc;
|
| 44 |
+
/* True iOS dark glass: dark background but white tint on islands */
|
| 45 |
+
--glass-bg: rgba(255, 255, 255, 0.08);
|
| 46 |
+
--glass-border: rgba(255, 255, 255, 0.15);
|
| 47 |
--glass-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
|
| 48 |
--icon-vibrant: #d946ef;
|
| 49 |
+
--btn-bg: rgba(255, 255, 255, 0.06);
|
| 50 |
}
|
| 51 |
|
| 52 |
body {
|
|
|
|
| 110 |
/* Interactive Islands */
|
| 111 |
.inner-btn {
|
| 112 |
background: var(--btn-bg);
|
| 113 |
+
border: 1px solid rgba(255, 255, 255, 0.15);
|
| 114 |
border-radius: 2.2rem;
|
| 115 |
padding: 1.6rem;
|
| 116 |
display: flex;
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
[data-theme="dark"] .inner-btn:hover:not(.disabled) {
|
| 131 |
+
background: rgba(255, 255, 255, 0.12);
|
| 132 |
box-shadow: 0 15px 35px rgba(217, 70, 239, 0.2);
|
| 133 |
}
|
| 134 |
|
| 135 |
.inner-btn:active:not(.disabled) { transform: scale(0.96) translateY(0); }
|
| 136 |
.inner-btn.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
|
| 137 |
|
| 138 |
+
/* Vibrant Icons */
|
| 139 |
.icon-vibrant { transition: all 0.4s ease; }
|
| 140 |
.icon-purple { color: #6d28d9; }
|
| 141 |
.icon-pink { color: #db2777; }
|
|
|
|
| 161 |
color: var(--text-secondary);
|
| 162 |
backdrop-filter: blur(10px);
|
| 163 |
}
|
| 164 |
+
[data-theme="dark"] .status-badge {
|
| 165 |
+
background: rgba(255, 255, 255, 0.1);
|
| 166 |
+
border: 1px solid rgba(255, 255, 255, 0.15);
|
| 167 |
+
}
|
| 168 |
|
| 169 |
.status-dot {
|
| 170 |
width: 8px;
|
|
|
|
| 190 |
background-clip: text;
|
| 191 |
animation: shimmer 4s linear infinite;
|
| 192 |
}
|
| 193 |
+
[data-theme="dark"] .logo-shimmer {
|
| 194 |
+
background: linear-gradient(90deg, #c084fc, #e879f9, #c084fc);
|
| 195 |
+
background-size: 200% auto;
|
| 196 |
+
color: transparent;
|
| 197 |
+
-webkit-background-clip: text;
|
| 198 |
+
background-clip: text;
|
| 199 |
+
}
|
| 200 |
|
| 201 |
@keyframes shimmer { to { background-position: 200% center; } }
|
| 202 |
|
|
|
|
| 311 |
</h1>
|
| 312 |
<div class="status-badge">
|
| 313 |
<span class="status-dot"></span>
|
| 314 |
+
AI Ensemble Active
|
| 315 |
</div>
|
| 316 |
</div>
|
| 317 |
</div>
|
|
|
|
| 346 |
|
| 347 |
<!-- FOOTER -->
|
| 348 |
<footer class="mt-auto pt-8 text-center opacity-40">
|
| 349 |
+
<p class="text-[10px] font-mono uppercase tracking-widest">Powered by PyTorch Ensemble</p>
|
| 350 |
</footer>
|
| 351 |
|
| 352 |
<!-- SCANNING SECTION (Initially Hidden) -->
|
|
|
|
| 382 |
<h2 id="result-diagnosis" class="text-3xl font-bold mb-1 text-center tracking-tight">--</h2>
|
| 383 |
<p id="result-severity" class="sub-label text-purple-600 dark:text-purple-400 mb-4 font-black text-xs">ANALYSIS COMPLETE</p>
|
| 384 |
|
| 385 |
+
<p id="result-desc" class="text-sm opacity-70 mb-6 font-medium text-center leading-relaxed max-w-[260px]">--</p>
|
| 386 |
|
| 387 |
+
<!-- Replaced Entropy with Full-Width Confidence -->
|
| 388 |
+
<div class="w-full bg-white/10 dark:bg-white/5 p-4 rounded-2xl border border-white/10 text-center mb-4 shadow-inner">
|
| 389 |
+
<p class="sub-label mb-1 opacity-50">AI Confidence Score</p>
|
| 390 |
+
<p id="result-conf" class="text-2xl font-mono font-bold">--%</p>
|
| 391 |
+
</div>
|
| 392 |
+
|
| 393 |
+
<!-- NEW: Precautions / Recommended Action Box -->
|
| 394 |
+
<div class="w-full bg-blue-500/10 dark:bg-blue-400/10 border border-blue-500/20 p-4 rounded-2xl mb-8 flex items-start gap-3 text-left shadow-sm">
|
| 395 |
+
<i data-lucide="info" class="w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0"></i>
|
| 396 |
+
<div>
|
| 397 |
+
<p class="sub-label text-blue-600 dark:text-blue-400 mb-1">Recommended Action</p>
|
| 398 |
+
<p id="result-action" class="text-sm font-medium leading-relaxed opacity-90">--</p>
|
| 399 |
</div>
|
| 400 |
</div>
|
| 401 |
|
|
|
|
| 593 |
|
| 594 |
const ctx = canvas.getContext('2d');
|
| 595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| 597 |
|
| 598 |
canvas.toBlob(blob => {
|
|
|
|
| 643 |
const steps = [
|
| 644 |
{ s: "Preprocessing", d: "Isolating Green Channel...", w: "30%" },
|
| 645 |
{ s: "Segmentation", d: "Mapping Vascular Geometry...", w: "65%" },
|
| 646 |
+
{ s: "AI Processing", d: "DenseNet & EfficientNet TTA...", w: "95%" },
|
| 647 |
{ s: "Finalizing", d: "Generating Diagnosis...", w: "100%" }
|
| 648 |
];
|
| 649 |
steps.forEach((step, i) => {
|
|
|
|
| 669 |
document.getElementById('result-severity').textContent = data.severity;
|
| 670 |
document.getElementById('result-desc').textContent = data.description;
|
| 671 |
document.getElementById('result-conf').textContent = data.confidence;
|
| 672 |
+
|
| 673 |
+
// Generate dynamic precautions based on diagnosis
|
| 674 |
+
const precautions = {
|
| 675 |
+
"No DR": "Maintain regular eye check-ups annually to ensure continuous ocular health.",
|
| 676 |
+
"Mild DR": "Monitor blood sugar levels closely. Schedule a follow-up eye exam in 6-12 months.",
|
| 677 |
+
"Moderate DR": "Consult an ophthalmologist soon. Optimize diabetes management to slow progression.",
|
| 678 |
+
"Severe DR": "Immediate ophthalmologist consultation required. Prompt treatment may be necessary.",
|
| 679 |
+
"Proliferative DR": "Urgent medical intervention needed to prevent severe vision loss (e.g., laser therapy or surgery)."
|
| 680 |
+
};
|
| 681 |
+
|
| 682 |
+
const diagnosisKey = data.diagnosis;
|
| 683 |
+
const actionText = precautions[diagnosisKey] || "Consult a healthcare professional for specific medical advice regarding your scan.";
|
| 684 |
+
document.getElementById('result-action').textContent = actionText;
|
| 685 |
+
|
| 686 |
lucide.createIcons();
|
| 687 |
switchView('view-result');
|
| 688 |
}
|