- Reduce max_new_tokens across all pipeline calls (400→200, 300→150,
512→200) — on CPU each token is ~1s so this roughly halves wall time
- Pre-download MONET and sentence-transformers in Dockerfile to
eliminate first-request model download stall
- Set OMP_NUM_THREADS=4 and MKL_NUM_THREADS=4 to fix libgomp warning
and ensure proper CPU parallelism
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use bfloat16 on CPU to halve memory (8GB vs 16GB float32)
Free-tier HF Spaces have 16GB RAM. MedGemma 4B in float32 consumed
~16GB for weights alone, causing swap thrashing. bfloat16 on CPU is
supported by modern PyTorch and halves memory to ~8GB.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix MCP subprocess deadlock: use stderr=None instead of PIPE
When the MCP subprocess downloads models (MONET, sentence-transformers)
on first call, progress output fills the 64KB stderr pipe buffer. The
subprocess blocks trying to write stderr while the main process blocks
reading stdout — classic pipe deadlock. Fix by inheriting parent stderr
so download progress prints directly to the container logs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add timeout and stderr logging to MCP subprocess to debug tool hangs
- _recv() now has 300s timeout instead of blocking forever
- _drain_stderr() captures MCP subprocess error output for debugging
- Checks if subprocess died and surfaces exit code
- Log MCP server start confirmation
- Fix max_length: only clear it, don't double-set max_new_tokens
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unused files: old Gradio frontend, dead model code, test artifacts
- frontend/ — entire old Gradio UI, replaced by React
- models/explainability.py — old GradCAM, replaced by gradcam_tool.py
- models/medsiglip_convnext_fusion.py — abandoned experimental model
- models/monet_concepts.py — old concept scorer, replaced by monet_tool.py
- test_models.py — one-off test script
- KAGGLE_REPORT.md — temporary report file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Force MCP tool models to CPU to avoid GPU VRAM contention with MedGemma
- MCP subprocess passes SKINPRO_TOOL_DEVICE=cpu env var
- MONET and ConvNeXt respect this override to stay on CPU
- Prevents OOM/hang on T4 (16GB) where MedGemma already uses ~8GB
- Fix max_length warning: set both max_length=None and max_new_tokens=400 on generation_config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add missing deps: sentence-transformers, pdfplumber, scipy for MCP tools
- sentence-transformers: required by GuidelinesRAG for FAISS embeddings
- pdfplumber: required by GuidelinesRAG for PDF text extraction
- scipy: required by MONET tool (scipy.special)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add RAG Phase 4 management guidance, rebuild guidelines index (286 chunks), post-analysis hint UI
- Landing page: sunrise orb with glassmorphism, about section, disclaimer
- Chat page: remove card wrappers from AI responses, plain text rendering
- Tool calls shown as inline status lines with dots/spinners (not cards)
- Thinking segments show animated spinner while active, done dot when complete
- Fix max_new_tokens vs max_length conflict in generation_config
- Fix Gemma3ImageProcessor warning by explicitly loading fast processor
- Add chat route import to backend routes __init__
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix requirements: opencv-headless (no libGL needed), remove unused gradio, add faiss-cpu and huggingface_hub
Patient-level chat UI with streaming AI analysis pipeline:
- MedGemma visual examination with stage-by-stage cascade
- ConvNeXt classifier with confidence scores and differential
- MONET feature extraction and Grad-CAM attention maps
- Temporal comparison between sequential lesion images
- Persistent chat history with full cascade replay on reload
- FastAPI backend with SSE streaming + React/TypeScript frontend
- Docker build ready for Hugging Face Spaces deployment