Spaces:
Runtime error
Runtime error
Update templates/result.html
Browse files- templates/result.html +108 -182
templates/result.html
CHANGED
|
@@ -1,182 +1,108 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>RetiCheck | AI Analysis Report</title>
|
| 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 |
-
<div
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
<
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
<
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
<
|
| 109 |
-
|
| 110 |
-
<button class="btn-print" onclick="window.print()">Download Medical Report (PDF)</button>
|
| 111 |
-
</div>
|
| 112 |
-
|
| 113 |
-
<script>
|
| 114 |
-
const aiDataJSON = localStorage.getItem('aiResult');
|
| 115 |
-
|
| 116 |
-
if(aiDataJSON) {
|
| 117 |
-
const aiData = JSON.parse(aiDataJSON);
|
| 118 |
-
|
| 119 |
-
// 1. SET IMAGES (Base64)
|
| 120 |
-
if(aiData.orig_img) {
|
| 121 |
-
document.getElementById('display-orig').src = "data:image/jpeg;base64," + aiData.orig_img;
|
| 122 |
-
}
|
| 123 |
-
if(aiData.heat_gen && aiData.heat_img) {
|
| 124 |
-
document.getElementById('display-heat').src = "data:image/jpeg;base64," + aiData.heat_img;
|
| 125 |
-
} else {
|
| 126 |
-
// If normal, just show original image again with a message
|
| 127 |
-
document.getElementById('display-heat').src = "data:image/jpeg;base64," + aiData.orig_img;
|
| 128 |
-
document.getElementById('heatmap-caption').innerText = "Healthy Retina (No Heatmap Needed)";
|
| 129 |
-
document.getElementById('heatmap-caption').style.color = "#10b981";
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
// 2. SET TEXT DATA
|
| 133 |
-
const headerStatus = document.getElementById('header-status');
|
| 134 |
-
const mainCard = document.getElementById('main-result-card');
|
| 135 |
-
const scoreTitle = document.getElementById('pred-title');
|
| 136 |
-
const scoreValue = document.getElementById('pred-score');
|
| 137 |
-
const scoreStatus = document.getElementById('pred-status');
|
| 138 |
-
const dummyCards = document.querySelectorAll('.dummy-card');
|
| 139 |
-
|
| 140 |
-
const verdictBox = document.getElementById('verdict-box');
|
| 141 |
-
const verdictTitle = document.getElementById('verdict-title');
|
| 142 |
-
const verdictText = document.getElementById('verdict-text');
|
| 143 |
-
|
| 144 |
-
headerStatus.innerText = "● System Diagnosis: " + aiData.triage;
|
| 145 |
-
scoreTitle.innerText = "AI Prediction: " + aiData.disease;
|
| 146 |
-
scoreValue.innerText = aiData.confidence;
|
| 147 |
-
scoreStatus.innerText = "Status: " + aiData.status;
|
| 148 |
-
|
| 149 |
-
verdictText.innerText = "Action Required: " + aiData.action + " | Doctor Advice: " + aiData.advice;
|
| 150 |
-
|
| 151 |
-
// 3. COLOR LOGIC
|
| 152 |
-
if(aiData.triage === "SAFE") {
|
| 153 |
-
const color = "#10b981";
|
| 154 |
-
headerStatus.style.color = color;
|
| 155 |
-
scoreValue.style.color = color;
|
| 156 |
-
mainCard.style.borderLeftColor = color;
|
| 157 |
-
verdictBox.style.background = "rgba(16, 185, 129, 0.1)";
|
| 158 |
-
verdictBox.style.borderColor = color;
|
| 159 |
-
verdictTitle.style.color = color;
|
| 160 |
-
} else if(aiData.triage === "URGENT") {
|
| 161 |
-
const color = "#ef4444";
|
| 162 |
-
headerStatus.style.color = color;
|
| 163 |
-
scoreValue.style.color = color;
|
| 164 |
-
mainCard.style.borderLeftColor = color;
|
| 165 |
-
verdictBox.style.background = "rgba(239, 68, 68, 0.1)";
|
| 166 |
-
verdictBox.style.borderColor = color;
|
| 167 |
-
verdictTitle.style.color = color;
|
| 168 |
-
} else {
|
| 169 |
-
const color = "#f59e0b";
|
| 170 |
-
headerStatus.style.color = color;
|
| 171 |
-
scoreValue.style.color = color;
|
| 172 |
-
mainCard.style.borderLeftColor = color;
|
| 173 |
-
verdictBox.style.background = "rgba(245, 158, 11, 0.1)";
|
| 174 |
-
verdictBox.style.borderColor = color;
|
| 175 |
-
verdictTitle.style.color = color;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
dummyCards.forEach(card => card.style.display = "none");
|
| 179 |
-
}
|
| 180 |
-
</script>
|
| 181 |
-
</body>
|
| 182 |
-
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>RetiCheck | AI Analysis Report</title>
|
| 7 |
+
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
|
| 9 |
+
|
| 10 |
+
<style>
|
| 11 |
+
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
|
| 12 |
+
body { background: #0f172a; color: white; padding: 30px; }
|
| 13 |
+
|
| 14 |
+
.report-container {
|
| 15 |
+
max-width: 1000px;
|
| 16 |
+
margin: 0 auto;
|
| 17 |
+
background: rgba(255, 255, 255, 0.03);
|
| 18 |
+
backdrop-filter: blur(15px);
|
| 19 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 20 |
+
border-radius: 30px;
|
| 21 |
+
padding: 40px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #334155; padding-bottom: 20px; }
|
| 25 |
+
.logo span { color: #00f2fe; }
|
| 26 |
+
|
| 27 |
+
/* AI Visualization Section */
|
| 28 |
+
.visualization-area {
|
| 29 |
+
display: grid;
|
| 30 |
+
grid-template-columns: 1fr 1fr;
|
| 31 |
+
gap: 20px;
|
| 32 |
+
margin: 30px 0;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.img-card {
|
| 36 |
+
background: #1e293b;
|
| 37 |
+
padding: 15px;
|
| 38 |
+
border-radius: 20px;
|
| 39 |
+
text-align: center;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/* FIX: இமேஜ் கட் ஆகாமல் முழுசாக தெரிய 'contain' பயன்படுத்தப்பட்டுள்ளது */
|
| 43 |
+
.img-card img {
|
| 44 |
+
width: 100%;
|
| 45 |
+
height: 250px;
|
| 46 |
+
object-fit: contain;
|
| 47 |
+
border-radius: 15px;
|
| 48 |
+
margin-bottom: 10px;
|
| 49 |
+
border: 2px solid #334155;
|
| 50 |
+
background: #000;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* Results Grid */
|
| 54 |
+
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; }
|
| 55 |
+
.res-card { background: rgba(255,255,255,0.05); padding: 20px; border-radius: 15px; text-align: center; border-left: 4px solid #334155; }
|
| 56 |
+
|
| 57 |
+
.btn-print {
|
| 58 |
+
width: 100%;
|
| 59 |
+
padding: 15px;
|
| 60 |
+
background: linear-gradient(90deg, #00f2fe, #4facfe);
|
| 61 |
+
border: none;
|
| 62 |
+
border-radius: 12px;
|
| 63 |
+
font-weight: bold;
|
| 64 |
+
cursor: pointer;
|
| 65 |
+
margin-top: 30px;
|
| 66 |
+
}
|
| 67 |
+
</style>
|
| 68 |
+
</head>
|
| 69 |
+
<body>
|
| 70 |
+
|
| 71 |
+
<div class="report-container" id="pdf-content">
|
| 72 |
+
<div class="header">
|
| 73 |
+
<h2 class="logo">RetiCheck <span>AI Report</span></h2>
|
| 74 |
+
<div id="header-status" style="color: #10b981; font-weight:bold;">● System Diagnosis: Loading...</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div class="visualization-area">
|
| 78 |
+
<div class="img-card">
|
| 79 |
+
<img id="display-orig" src="" alt="Original Scan">
|
| 80 |
+
<p style="font-size: 13px; color: #94a3b8;">Original Fundus Image</p>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div class="img-card">
|
| 84 |
+
<img id="display-heat" src="" alt="Heatmap Scan">
|
| 85 |
+
<p style="font-size: 13px; color: #00f2fe;" id="heatmap-caption">AI Heatmap Visualization (XAI)</p>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<h3>Pathology Detection</h3>
|
| 90 |
+
<div class="result-grid">
|
| 91 |
+
<div class="res-card" id="main-result-card">
|
| 92 |
+
<p style="font-size: 12px; color: #94a3b8;" id="pred-title">Analyzing...</p>
|
| 93 |
+
<h2 id="pred-score">--%</h2>
|
| 94 |
+
<small id="pred-status">Please wait...</small>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="res-card dummy-card">
|
| 97 |
+
<p style="font-size: 12px; color: #94a3b8;">Glaucoma</p>
|
| 98 |
+
<h2 style="color: #10b981;">--</h2>
|
| 99 |
+
<small>Scanning...</small>
|
| 100 |
+
</div>
|
| 101 |
+
<div class="res-card dummy-card">
|
| 102 |
+
<p style="font-size: 12px; color: #94a3b8;">AMD</p>
|
| 103 |
+
<h2 style="color: #10b981;">--</h2>
|
| 104 |
+
<small>Scanning...</small>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<div id="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|