Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub (part 2)
Browse files- test_gen.pdf +3 -0
- web_dashboard/app.js +25 -50
test_gen.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56c50eea43a0af1f0b117f6894d0e2c9e065e8b728f8c6523b9251794125f5f7
|
| 3 |
+
size 3127
|
web_dashboard/app.js
CHANGED
|
@@ -2425,58 +2425,33 @@ async function downloadPatientPDF() {
|
|
| 2425 |
}
|
| 2426 |
try {
|
| 2427 |
const r = window.currentPatientReport;
|
| 2428 |
-
const verdict = r.verdict === 'no_tumor' ? 'No abnormalities detected.' : 'Region requiring medical review detected.';
|
| 2429 |
-
const riskBadgeColor = r.verdict === 'no_tumor' ? '#10b981' : (r.risk_score > 60 ? '#ef4444' : '#f39c12');
|
| 2430 |
-
const riskLevel = r.verdict === 'no_tumor' ? 'Low Risk' : (r.risk_score > 60 ? 'High Risk' : 'Medium Risk');
|
| 2431 |
|
| 2432 |
-
const
|
| 2433 |
-
|
| 2434 |
-
|
| 2435 |
-
|
| 2436 |
-
|
| 2437 |
-
|
| 2438 |
-
|
| 2439 |
-
|
| 2440 |
-
|
| 2441 |
-
|
| 2442 |
-
|
| 2443 |
-
|
| 2444 |
-
|
| 2445 |
-
|
| 2446 |
-
|
| 2447 |
-
|
| 2448 |
-
|
| 2449 |
-
|
| 2450 |
-
|
| 2451 |
-
|
| 2452 |
-
|
| 2453 |
-
|
| 2454 |
-
|
| 2455 |
-
|
| 2456 |
-
<div class="card">
|
| 2457 |
-
<h2>Diagnostic Summary</h2>
|
| 2458 |
-
<div class="row"><span class="label">Result:</span> <span>${verdict}</span></div>
|
| 2459 |
-
<div class="row"><span class="label">AI Confidence:</span> <span>${r.confidence || '99.9'}%</span></div>
|
| 2460 |
-
<div class="row"><span class="label">Risk Level:</span> <span class="badge">${riskLevel}</span></div>
|
| 2461 |
-
<div class="row"><span class="label">Estimated Volume:</span> <span>${r.volume_cm3 || "0.0"} cm³</span></div>
|
| 2462 |
-
<div class="row"><span class="label">Date:</span> <span>${new Date().toLocaleString()}</span></div>
|
| 2463 |
-
</div>
|
| 2464 |
-
|
| 2465 |
-
<div class="disclaimer">
|
| 2466 |
-
<strong>CLINICAL DISCLAIMER:</strong> This report is generated by an AI research prototype (Tri-Netra 4-Detector Ensemble). It is NOT a verified clinical diagnosis. The risk scores and follow-up recommendations are for informational purposes only. Do not make medical decisions based on this report. Please consult a qualified healthcare professional.
|
| 2467 |
-
</div>
|
| 2468 |
-
|
| 2469 |
-
<script>
|
| 2470 |
-
window.onload = function() {
|
| 2471 |
-
window.print();
|
| 2472 |
-
};
|
| 2473 |
-
</script>
|
| 2474 |
-
</body>
|
| 2475 |
-
</html>
|
| 2476 |
-
`);
|
| 2477 |
-
win.document.close();
|
| 2478 |
} catch (e) {
|
| 2479 |
console.error(e);
|
| 2480 |
-
alert('Failed to generate PDF
|
| 2481 |
}
|
| 2482 |
}
|
|
|
|
| 2425 |
}
|
| 2426 |
try {
|
| 2427 |
const r = window.currentPatientReport;
|
|
|
|
|
|
|
|
|
|
| 2428 |
|
| 2429 |
+
const res = await fetch('/generate_pdf', {
|
| 2430 |
+
method: 'POST',
|
| 2431 |
+
headers: {'Content-Type': 'application/json'},
|
| 2432 |
+
body: JSON.stringify({
|
| 2433 |
+
confidence: r.confidence,
|
| 2434 |
+
verdict: r.verdict,
|
| 2435 |
+
volume_cm3: r.volume_cm3,
|
| 2436 |
+
risk_level: r.verdict === 'no_tumor' ? 'Low Risk' : (r.risk_score > 60 ? 'High Risk' : 'Medium Risk'),
|
| 2437 |
+
risk_score: r.risk_score,
|
| 2438 |
+
follow_up: r.follow_up
|
| 2439 |
+
})
|
| 2440 |
+
});
|
| 2441 |
+
|
| 2442 |
+
if (!res.ok) throw new Error('PDF generation failed');
|
| 2443 |
+
|
| 2444 |
+
const blob = await res.blob();
|
| 2445 |
+
const url = window.URL.createObjectURL(blob);
|
| 2446 |
+
const a = document.createElement('a');
|
| 2447 |
+
a.style.display = 'none';
|
| 2448 |
+
a.href = url;
|
| 2449 |
+
a.download = 'Tri_Netra_Report.pdf';
|
| 2450 |
+
document.body.appendChild(a);
|
| 2451 |
+
a.click();
|
| 2452 |
+
window.URL.revokeObjectURL(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2453 |
} catch (e) {
|
| 2454 |
console.error(e);
|
| 2455 |
+
alert('Failed to generate PDF report. Please try again.');
|
| 2456 |
}
|
| 2457 |
}
|