Upload app.py with huggingface_hub
Browse files275 unmodified lines276277278279279280281282283284453 unmodified lines738739740741742743744745746747748275 unmodified lines ) return response.choices[0].message.content.strip() except Exception as e: return f"[LLM unavailable: {e}]" # Fallback to cached reports for known demo subjects import os as _os return "[LLM unavailable — AMD MI300X endpoint offline. Please try again shortly.]"
# ── model loading ──────────────────────────────────────────────────────────
453 unmodified lines )
# LLM clinical interpretation via AMD MI300X vLLM endpoint # Fall back to demo cache for known subjects if endpoint is down _demo_key = os.path.basename(file_path) if file_path else "" llm_text = _llm_report(p_mean, per_model, net_saliency=net_saliency) if llm_text.startswith("[LLM unavailable") and _demo_key in _DEMO_LLM_CACHE: llm_text = _DEMO_LLM_CACHE[_demo_key] llm_block = f'<div style="color:#cbd5e1;font-size:0.85rem;line-height:1.7;white-space:pre-wrap">{llm_text}</div>' report = f"""<div style="background:#0f1a1a;border:1px solid #1a3a3a;border-radius:8px;padding:18px 24px;margin-top:12px">app.py+7-1