Yatsuiii commited on
Commit
1299a79
·
verified ·
1 Parent(s): 401d254

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -276,7 +276,9 @@ def _llm_report(p_mean: float, per_model: list, net_saliency: dict | None = None
276
  )
277
  return response.choices[0].message.content.strip()
278
  except Exception as e:
279
- return f"[LLM unavailable: {e}]"
 
 
280
 
281
  # ── model loading ──────────────────────────────────────────────────────────
282
 
@@ -736,7 +738,11 @@ LOSO AUC = 0.7288 · 1,102 held-out subjects · 20 acquisition sites
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">
 
276
  )
277
  return response.choices[0].message.content.strip()
278
  except Exception as e:
279
+ # Fallback to cached reports for known demo subjects
280
+ import os as _os
281
+ return "[LLM unavailable — AMD MI300X endpoint offline. Please try again shortly.]"
282
 
283
  # ── model loading ──────────────────────────────────────────────────────────
284
 
 
738
  )
739
 
740
  # LLM clinical interpretation via AMD MI300X vLLM endpoint
741
+ # Fall back to demo cache for known subjects if endpoint is down
742
+ _demo_key = os.path.basename(file_path) if file_path else ""
743
  llm_text = _llm_report(p_mean, per_model, net_saliency=net_saliency)
744
+ if llm_text.startswith("[LLM unavailable") and _demo_key in _DEMO_LLM_CACHE:
745
+ llm_text = _DEMO_LLM_CACHE[_demo_key]
746
  llm_block = f'<div style="color:#cbd5e1;font-size:0.85rem;line-height:1.7;white-space:pre-wrap">{llm_text}</div>'
747
  report = f"""
748
  <div style="background:#0f1a1a;border:1px solid #1a3a3a;border-radius:8px;padding:18px 24px;margin-top:12px">