Manvith/Endoscopy-Eso
0
NOVA-GI Unified — Inference App
A dependency-light inference UI for the trained NOVA-GI Unified models. It reproduces the exact preprocessing and pipeline from NOVA_GI_Unified_updated.ipynb (final inference cell).
What it does
- Loads all saved dataset models (one head per dataset — Gastroendonet, Gastrovision, hyper-kvasir, kvasir-v1, kvasir-v2, WCEBleedGen). For each it picks
best_ema.ptorbest_model.ptper the run'schosen_model, plus itsclass_map.json+temperature.json. - For every uploaded image it applies that dataset's preprocessing (specular-inpaint → gray-world → CLAHE-LAB → resize 240px
INTER_AREA→ ToTensor → ImageNet normalize), runs the full architecture, and returnssoftmax(logits / T). - All heads score the image; the most confident findings are ranked (class / sub-class / region / severity / calibrated confidence).
- One-click Save interactive HTML exports a self-contained report.
Run locally
.venv\Scripts\python.exe inference_app\app.pyThen open <http://127.0.0.1:7860>. Uses the local ../NOVA_GI_Unified_outputs/<dataset>/seed42_var_full/ weights. Runs on CPU.
Deploy (Hugging Face Space)
Weights are not committed to this repo. Set the NOVA_GI_MODEL_REPO environment variable (Space → Settings → Variables) to your HF model repo id (e.g. your-username/nova-gi-unified). On boot the app downloads the six checkpoints + JSONs from that repo and caches them. See DEPLOY.md for the full step-by-step, and upload_weights.py for the one-time weight upload.
Files
nova_gi_engine.py— model definition, preprocessing, registry,predict_image().app.py— stdlib web server + browser UI + HTML export.Dockerfile,requirements.txt— container build for the Space.upload_weights.py— pushes the needed checkpoints to an HF model repo.
Notes
- Research/educational use only — not a medical device.
