HF Space deployment needs every showcase path to work without external
data. Five artifacts are gitignored (model binaries, RAG index, derived
fixtures) so they have to be (re)generated at image-build time.
- scripts/seed_demo_artifacts.py: idempotent generator for
data/processed/mri_dl_2d/best_model.pt (random resnet18 4-class),
data/processed/mri_model.onnx (dynamic-D/H/W ONNX biased to 'abnormal'),
data/processed/eeg_clf.joblib (synthetic-separable RandomForest),
data/external_rag/index/rag_index.pkl (4-chunk synthetic clinical
TF-IDF index), and tests/fixtures/mri_sample/subject_0_axial.png
(axial slice from the bundled NIfTI). Each step is a no-op when the
artifact already exists.
- Dockerfile.hf: COPY scripts/, RUN seed_demo_artifacts.py after the
pipeline + FAISS-index build steps. Keeps Dockerfile (HF
auto-discovered name) byte-identical to Dockerfile.hf.
- docker-entrypoint.sh: re-run the seed script on container start so a
mounted-volume deploy can re-s…
- C1 (Critical): Capture curl exit code instead of aborting script under set -e; network failures now
surface as FAIL lines with exit 1, not opaque curl exit codes like 7
- I1 (Important): Rename third probe label from "POST to unknown path is rejected" to
"fastapi :8000 not publicly routed (POST)" for clarity on test intent
- M3 (Minor): Add --max-time 15 to all curl calls to prevent indefinite hangs if HF Tornado
accepts TCP but stalls mid-response
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(deploy): smoke probe — POST to unknown path expects 403, not GET to /health
HF Space's Tornado server returns 200 with SPA HTML for any GET path,
including /health. The original probe incorrectly expected 403 on GET.
POST requests to non-existent endpoints correctly return 403, so this
test is moved to a meaningful assertion: verify unknown POST paths
are rejected. Widened probe() helper to accept HTTP method parameter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>