vaithi663 commited on
Commit
bb39cd1
·
verified ·
1 Parent(s): a1237b9

Update templates/result.html

Browse files
Files changed (1) hide show
  1. templates/result.html +117 -4
templates/result.html CHANGED
@@ -24,7 +24,6 @@
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;
@@ -39,7 +38,6 @@
39
  text-align: center;
40
  }
41
 
42
- /* FIX: இமேஜ் கட் ஆகாமல் முழுசாக தெரிய 'contain' பயன்படுத்தப்பட்டுள்ளது */
43
  .img-card img {
44
  width: 100%;
45
  height: 250px;
@@ -50,7 +48,6 @@
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
 
@@ -63,7 +60,22 @@
63
  font-weight: bold;
64
  cursor: pointer;
65
  margin-top: 30px;
 
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  </style>
68
  </head>
69
  <body>
@@ -105,4 +117,105 @@
105
  </div>
106
  </div>
107
 
108
- <div id="
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  .visualization-area {
28
  display: grid;
29
  grid-template-columns: 1fr 1fr;
 
38
  text-align: center;
39
  }
40
 
 
41
  .img-card img {
42
  width: 100%;
43
  height: 250px;
 
48
  background: #000;
49
  }
50
 
 
51
  .result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; }
52
  .res-card { background: rgba(255,255,255,0.05); padding: 20px; border-radius: 15px; text-align: center; border-left: 4px solid #334155; }
53
 
 
60
  font-weight: bold;
61
  cursor: pointer;
62
  margin-top: 30px;
63
+ color: #0f172a;
64
  }
65
+
66
+ .btn-back {
67
+ width: 100%;
68
+ padding: 15px;
69
+ background: #334155;
70
+ border: none;
71
+ border-radius: 12px;
72
+ font-weight: bold;
73
+ cursor: pointer;
74
+ margin-top: 15px;
75
+ color: white;
76
+ transition: 0.3s;
77
+ }
78
+ .btn-back:hover { background: #475569; }
79
  </style>
80
  </head>
81
  <body>
 
117
  </div>
118
  </div>
119
 
120
+ <div id="verdict-box" style="margin-top: 30px; padding: 20px; border-radius: 15px; border: 1px solid #334155;">
121
+ <strong id="verdict-title">AI Clinical Verdict:</strong>
122
+ <p id="verdict-text" style="font-size: 14px; margin-top: 5px;">Analyzing clinical correlations...</p>
123
+ </div>
124
+ </div>
125
+
126
+ <div style="max-width: 1000px; margin: 0 auto;">
127
+ <button class="btn-print" id="downloadBtn" onclick="generatePDF()">Download Medical Report (PDF)</button>
128
+ <button class="btn-back" onclick="window.location.href='/'">Scan Another Image (Go Back)</button>
129
+ </div>
130
+
131
+ <script>
132
+ function generatePDF() {
133
+ const btn = document.getElementById('downloadBtn');
134
+ btn.innerText = "Generating PDF... Please wait";
135
+ btn.style.opacity = "0.7";
136
+
137
+ const element = document.getElementById('pdf-content');
138
+
139
+ const opt = {
140
+ margin: 0.3,
141
+ filename: 'RetiCheck_AI_Report.pdf',
142
+ image: { type: 'jpeg', quality: 0.98 },
143
+ html2canvas: { scale: 2, useCORS: true, backgroundColor: '#0f172a' },
144
+ jsPDF: { unit: 'in', format: 'a4', orientation: 'portrait' }
145
+ };
146
+
147
+ html2pdf().set(opt).from(element).save().then(() => {
148
+ btn.innerText = "Download Medical Report (PDF)";
149
+ btn.style.opacity = "1";
150
+ });
151
+ }
152
+
153
+ const aiDataJSON = localStorage.getItem('aiResult');
154
+
155
+ // --- 100% BUG FIX LOGIC ---
156
+ if(!aiDataJSON) {
157
+ // Data illana automatic ah Home page ku poidum! (No broken screen)
158
+ window.location.href = '/';
159
+ } else {
160
+ const aiData = JSON.parse(aiDataJSON);
161
+
162
+ if(aiData.orig_img) {
163
+ document.getElementById('display-orig').src = "data:image/jpeg;base64," + aiData.orig_img;
164
+ }
165
+ if(aiData.heat_gen && aiData.heat_img) {
166
+ document.getElementById('display-heat').src = "data:image/jpeg;base64," + aiData.heat_img;
167
+ } else {
168
+ document.getElementById('display-heat').src = "data:image/jpeg;base64," + aiData.orig_img;
169
+ document.getElementById('heatmap-caption').innerText = "Healthy Retina (No Heatmap Needed)";
170
+ document.getElementById('heatmap-caption').style.color = "#10b981";
171
+ }
172
+
173
+ const headerStatus = document.getElementById('header-status');
174
+ const mainCard = document.getElementById('main-result-card');
175
+ const scoreTitle = document.getElementById('pred-title');
176
+ const scoreValue = document.getElementById('pred-score');
177
+ const scoreStatus = document.getElementById('pred-status');
178
+ const dummyCards = document.querySelectorAll('.dummy-card');
179
+
180
+ const verdictBox = document.getElementById('verdict-box');
181
+ const verdictTitle = document.getElementById('verdict-title');
182
+ const verdictText = document.getElementById('verdict-text');
183
+
184
+ headerStatus.innerText = "● System Diagnosis: " + aiData.triage;
185
+ scoreTitle.innerText = "AI Prediction: " + aiData.disease;
186
+ scoreValue.innerText = aiData.confidence;
187
+ scoreStatus.innerText = "Status: " + aiData.status;
188
+
189
+ verdictText.innerText = "Action Required: " + aiData.action + " | Doctor Advice: " + aiData.advice;
190
+
191
+ if(aiData.triage === "SAFE") {
192
+ const color = "#10b981";
193
+ headerStatus.style.color = color;
194
+ scoreValue.style.color = color;
195
+ mainCard.style.borderLeftColor = color;
196
+ verdictBox.style.background = "rgba(16, 185, 129, 0.1)";
197
+ verdictBox.style.borderColor = color;
198
+ verdictTitle.style.color = color;
199
+ } else if(aiData.triage === "URGENT") {
200
+ const color = "#ef4444";
201
+ headerStatus.style.color = color;
202
+ scoreValue.style.color = color;
203
+ mainCard.style.borderLeftColor = color;
204
+ verdictBox.style.background = "rgba(239, 68, 68, 0.1)";
205
+ verdictBox.style.borderColor = color;
206
+ verdictTitle.style.color = color;
207
+ } else {
208
+ const color = "#f59e0b";
209
+ headerStatus.style.color = color;
210
+ scoreValue.style.color = color;
211
+ mainCard.style.borderLeftColor = color;
212
+ verdictBox.style.background = "rgba(245, 158, 11, 0.1)";
213
+ verdictBox.style.borderColor = color;
214
+ verdictTitle.style.color = color;
215
+ }
216
+
217
+ dummyCards.forEach(card => card.style.display = "none");
218
+ }
219
+ </script>
220
+ </body>
221
+ </html>