Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub (part 2)
Browse filesFiles changed (2)
- test_gen.pdfAdded+3
- web_dashboard/app.js+25-50
123version https://git-lfs.github.com/spec/v1oid sha256:56c50eea43a0af1f0b117f6894d0e2c9e065e8b728f8c6523b9251794125f5f7size 31272424 unmodified lines24252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822424 unmodified lines}try {const r = window.currentPatientReport;const verdict = r.verdict === 'no_tumor' ? 'No abnormalities detected.' : 'Region requiring medical review detected.';const riskBadgeColor = r.verdict === 'no_tumor' ? '#10b981' : (r.risk_score > 60 ? '#ef4444' : '#f39c12');const riskLevel = r.verdict === 'no_tumor' ? 'Low Risk' : (r.risk_score > 60 ? 'High Risk' : 'Medium Risk');const win = window.open('', '_blank');win.document.write(`<!DOCTYPE html><html><head><title>Medical Report</title><style>body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 40px; color: #333; line-height: 1.6; }.header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid #f48fb1; padding-bottom: 20px; }.header h1 { color: #880e4f; margin: 0; font-size: 28px; }.header p { color: #666; margin-top: 5px; }.card { border: 1px solid #ddd; border-radius: 8px; padding: 20px; margin-bottom: 20px; background: #fafafa; }.row { display: flex; justify-content: space-between; margin-bottom: 10px; }.label { font-weight: bold; color: #555; }.badge { display: inline-block; padding: 5px 12px; border-radius: 20px; color: white; font-weight: bold; background: ${riskBadgeColor}; }.disclaimer { margin-top: 40px; font-size: 11px; color: #888; text-align: justify; border-top: 1px solid #eee; padding-top: 20px; }</style></head><body><div class="header"><h1>Tri-Netra AI</h1><p>Patient Scan Analysis Report</p></div><div class="card"><h2>Diagnostic Summary</h2><div class="row"><span class="label">Result:</span> <span>${verdict}</span></div><div class="row"><span class="label">AI Confidence:</span> <span>${r.confidence || '99.9'}%</span></div><div class="row"><span class="label">Risk Level:</span> <span class="badge">${riskLevel}</span></div><div class="row"><span class="label">Estimated Volume:</span> <span>${r.volume_cm3 || "0.0"} cm³</span></div><div class="row"><span class="label">Date:</span> <span>${new Date().toLocaleString()}</span></div></div><div class="disclaimer"><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.</div><script>window.onload = function() {window.print();};</script></body></html>`);win.document.close();} catch (e) {console.error(e);alert('Failed to generate PDF view. Please try again.');}}2424 unmodified lines2425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572424 unmodified lines}try {const r = window.currentPatientReport;const res = await fetch('/generate_pdf', {method: 'POST',headers: {'Content-Type': 'application/json'},body: JSON.stringify({confidence: r.confidence,verdict: r.verdict,volume_cm3: r.volume_cm3,risk_level: r.verdict === 'no_tumor' ? 'Low Risk' : (r.risk_score > 60 ? 'High Risk' : 'Medium Risk'),risk_score: r.risk_score,follow_up: r.follow_up})});if (!res.ok) throw new Error('PDF generation failed');const blob = await res.blob();const url = window.URL.createObjectURL(blob);const a = document.createElement('a');a.style.display = 'none';a.href = url;a.download = 'Tri_Netra_Report.pdf';document.body.appendChild(a);a.click();window.URL.revokeObjectURL(url);} catch (e) {console.error(e);alert('Failed to generate PDF report. Please try again.');}}
test_gen.pdfAdded+3
web_dashboard/app.js+25-50