Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -735,47 +735,18 @@ LOSO AUC = 0.7288 · 1,102 held-out subjects · 20 acquisition sites
|
|
| 735 |
for r in refs
|
| 736 |
)
|
| 737 |
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px">
|
| 742 |
-
<div><div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1px;margin-bottom:3px">ICD-10 Classification</div>
|
| 743 |
-
<div style="color:#cbd5e1;font-size:0.84rem;line-height:1.4">{icd}</div></div>
|
| 744 |
-
<div><div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1px;margin-bottom:3px">Ensemble Confidence</div>
|
| 745 |
-
<div style="color:#cbd5e1;font-size:0.84rem">{conf:.1f}% · p(ASD) = {p_mean:.3f} · {len(models)}-model LOSO</div></div>
|
| 746 |
-
</div>
|
| 747 |
-
|
| 748 |
-
<div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:4px;font-weight:500">Impression</div>
|
| 749 |
-
<div style="color:#f4f4f5;font-size:0.92rem;margin-bottom:14px;line-height:1.55">{imp}</div>
|
| 750 |
-
|
| 751 |
-
<div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:4px;font-weight:500">Connectivity Findings</div>
|
| 752 |
-
<ul style="margin:0 0 14px 0;padding-left:18px;font-size:0.88rem">{fi}</ul>
|
| 753 |
-
|
| 754 |
-
<div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:4px;font-weight:500">Cross-Site Consistency</div>
|
| 755 |
-
<div style="color:#cbd5e1;font-size:0.86rem;margin-bottom:14px;line-height:1.55">{cons}</div>
|
| 756 |
-
|
| 757 |
-
<div style="color:#8b95a7;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:6px;font-weight:500">Supporting Literature</div>
|
| 758 |
-
<div style="margin-bottom:14px">{refs_html}</div>
|
| 759 |
-
|
| 760 |
-
<div style="border-top:1px solid #252a35;padding-top:10px;color:#5e6675;font-size:0.74rem;line-height:1.5">
|
| 761 |
-
AI-assisted screening only · Not a clinical diagnosis · Findings must be integrated with ADOS-2, ADI-R, and full developmental history · Refer to licensed neuropsychologist for formal evaluation.</div></div>"""
|
| 762 |
-
|
| 763 |
-
# LLM clinical interpretation (only attempt if GPU is available)
|
| 764 |
-
import os
|
| 765 |
-
# Use cached report for demo subjects (instant), else call AMD MI300X
|
| 766 |
-
_demo_key = os.path.basename(file_path) if file_path else ""
|
| 767 |
-
if _demo_key in _DEMO_LLM_CACHE:
|
| 768 |
-
llm_text = _DEMO_LLM_CACHE[_demo_key]
|
| 769 |
-
else:
|
| 770 |
-
llm_text = _llm_report(p_mean, per_model, net_saliency=net_saliency)
|
| 771 |
llm_block = f'<div style="color:#cbd5e1;font-size:0.85rem;line-height:1.7;white-space:pre-wrap">{llm_text}</div>'
|
| 772 |
-
report
|
| 773 |
<div style="background:#0f1a1a;border:1px solid #1a3a3a;border-radius:8px;padding:18px 24px;margin-top:12px">
|
| 774 |
<div style="display:flex;align-items:center;gap:10px;margin-bottom:10px">
|
| 775 |
<span style="color:#2dc653;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;font-weight:600">Qwen2.5-7B Clinical Interpreter</span>
|
| 776 |
<span style="background:#1f1a10;border:1px solid #fb923c44;color:#fb923c;font-size:0.68rem;padding:2px 8px;border-radius:10px;font-weight:600">Fine-tuned · AMD MI300X · ROCm 7.0</span>
|
| 777 |
</div>
|
| 778 |
{llm_block}
|
|
|
|
|
|
|
| 779 |
</div>"""
|
| 780 |
|
| 781 |
return verdict, ensemble, report, sal_img
|
|
|
|
| 735 |
for r in refs
|
| 736 |
)
|
| 737 |
|
| 738 |
+
# LLM clinical interpretation via AMD MI300X vLLM endpoint
|
| 739 |
+
llm_text = _llm_report(p_mean, per_model, net_saliency=net_saliency)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
llm_block = f'<div style="color:#cbd5e1;font-size:0.85rem;line-height:1.7;white-space:pre-wrap">{llm_text}</div>'
|
| 741 |
+
report = f"""
|
| 742 |
<div style="background:#0f1a1a;border:1px solid #1a3a3a;border-radius:8px;padding:18px 24px;margin-top:12px">
|
| 743 |
<div style="display:flex;align-items:center;gap:10px;margin-bottom:10px">
|
| 744 |
<span style="color:#2dc653;font-size:0.68rem;text-transform:uppercase;letter-spacing:1.5px;font-weight:600">Qwen2.5-7B Clinical Interpreter</span>
|
| 745 |
<span style="background:#1f1a10;border:1px solid #fb923c44;color:#fb923c;font-size:0.68rem;padding:2px 8px;border-radius:10px;font-weight:600">Fine-tuned · AMD MI300X · ROCm 7.0</span>
|
| 746 |
</div>
|
| 747 |
{llm_block}
|
| 748 |
+
<div style="border-top:1px solid #1a3a3a;padding-top:10px;margin-top:12px;color:#5e6675;font-size:0.74rem;line-height:1.5">
|
| 749 |
+
AI-assisted screening only · Not a clinical diagnosis · Findings must be integrated with ADOS-2, ADI-R, and full developmental history · Refer to licensed neuropsychologist for formal evaluation.</div>
|
| 750 |
</div>"""
|
| 751 |
|
| 752 |
return verdict, ensemble, report, sal_img
|