Upload app.py with huggingface_hub
Browse files114 unmodified lines1151161171181191201211221231241251262 unmodified lines1291301311321331341359 unmodified lines1451461471481491501511528 unmodified lines161162163164165166167168114 unmodified linesp = torch.softmax(logits, -1)[0, 1].item()per_model.append((site, p))p_mean = float(np.mean([p for _, p in per_model]))label = "ASD" if p_mean > 0.5 else "Typical Control"conf = max(p_mean, 1 - p_mean) * 100consensus = sum(1 for _, p in per_model if p > 0.5)gcn_out = f"Prediction : {label}\n"gcn_out += f"Confidence : {conf:.1f}% (p_ASD = {p_mean:.3f})\n"gcn_out += f"Consensus : {consensus}/4 site models\n\n"gcn_out += "Per-model breakdown:\n"2 unmodified lineslbl = "ASD" if p > 0.5 else "TC "gcn_out += f" {site:>4} {lbl} {bar} {p:.3f}\n"# Clinical interpretation stub — replaced by fine-tuned Qwen2.5-7B on AMD MI300Xasd_features = ["Reduced DMN coherence (mPFC ↔ PCC)","Atypical salience network lateralization",9 unmodified lines"Cerebellar–cortical coupling within expected range",]report = f"## Clinical Connectivity Summary\n\n"report += f"**Overall**: {label} ({conf:.1f}% confidence, {consensus}/4 site consensus)\n\n"if p_mean > 0.6:report += "**Key Findings**:\n"for f in asd_features[:3]:8 unmodified linesreport += "\n**Cross-Site Consistency**: Typical connectivity profile confirmed "report += f"by {4 - consensus}/4 independent site models.\n\n"else:report += "**Indeterminate**: Mixed connectivity profile near ASD–TC boundary. "report += "Heightened clinical scrutiny recommended.\n\n"report += "*This report is AI-assisted and does not constitute a diagnosis. "report += "Full clinical assessment required.*\n\n"114 unmodified lines1151161171181191201211221231241251261271281291301311321331341351362 unmodified lines1391401411421431449 unmodified lines1541551561571581591601611628 unmodified lines171172173174175176177178179180181182114 unmodified linesp = torch.softmax(logits, -1)[0, 1].item()per_model.append((site, p))p_mean = float(np.mean([p for _, p in per_model]))consensus = sum(1 for _, p in per_model if p > 0.5)conf = max(p_mean, 1 - p_mean) * 100if p_mean > 0.6:label = "ASD"status = "HIGH CONFIDENCE"elif p_mean < 0.4:label = "Typical Control"status = "HIGH CONFIDENCE"else:label = "Inconclusive"status = "LOW CONFIDENCE — CLINICAL REVIEW RECOMMENDED"gcn_out = f"Prediction : {label}\n"gcn_out += f"Status : {status}\n"gcn_out += f"Confidence : {conf:.1f}% (p_ASD = {p_mean:.3f})\n"gcn_out += f"Consensus : {consensus}/4 site models\n\n"gcn_out += "Per-model breakdown:\n"2 unmodified lineslbl = "ASD" if p > 0.5 else "TC "gcn_out += f" {site:>4} {lbl} {bar} {p:.3f}\n"asd_features = ["Reduced DMN coherence (mPFC ↔ PCC)","Atypical salience network lateralization",9 unmodified lines"Cerebellar–cortical coupling within expected range",]report = "## Clinical Connectivity Summary\n\n"report += f"**Overall**: {label} ({conf:.1f}% confidence, {consensus}/4 site consensus)\n\n"if p_mean > 0.6:report += "**Key Findings**:\n"for f in asd_features[:3]:8 unmodified linesreport += "\n**Cross-Site Consistency**: Typical connectivity profile confirmed "report += f"by {4 - consensus}/4 independent site models.\n\n"else:report += "**Inconclusive — Clinical Review Required**\n\n"report += "Connectivity pattern falls near the ASD–Typical Control boundary. "report += f"Model disagreement ({consensus}/4 site models predict ASD) indicates "report += "insufficient confidence for an automated call.\n\n"report += "**Recommended action**: Refer for full neuropsychological evaluation "report += "(ADOS-2, ADI-R) and structural MRI review.\n\n"report += "*This report is AI-assisted and does not constitute a diagnosis. "report += "Full clinical assessment required.*\n\n"
app.py+22-8