TASK - Deployment with Frontend (full-stack SatQuery AI demo)
Objective: a juror-usable demo at http://localhost:8000 - upload image(s) → Analyze → answer + spatial evidence + trace + JSON report. Code: frontend/index.html + app/backend/ (controller, registry, report, main.py).
How it fits together
main.pyserves/(staticindex.html) andPOST /api/analyze; model loads lazily once viaget_pipeline().- Without
SATQUERY_CHECKPOINT, the app builds foundation weights (SATQUERY_LLMdefaultQwen/Qwen3-0.6B,SATQUERY_VISIONSigLIP-2-base,max_patches=256) - pipeline works, answer quality = untrained; the report carries a disclaimer. Set the env var for trained quality. - Input modes: 1 image (VQA/caption/grounding), 2 same-modality (bi-temporal change), 2 cross-modality (optical+SAR fusion). TIFF via rasterio, PNG/JPEG via PIL (
main.py:_read_upload_to_array).
Steps
- Check the active model before starting the frontend:
curl http://localhost:8000/api/model
The API selects weights in this order: checkpoints/final,
checkpoints/stage2/final, checkpoints/stage1/final, and
checkpoints/baseline-small/final. If none exists, it serves the small
foundation model so frontend work can continue.
2. Backend up:
cd backend && source ../.venv/bin/activate
SATQUERY_CHECKPOINT=checkpoints/final python -m uvicorn app.backend.main:app --host 0.0.0.0 --port 8000
- Open
http://localhost:8000, upload image(s), type query, Analyze. Expect: answer, boxes/points on canvas, confidence bar, execution trace, downloadable JSON report. - Dockerized demo (same app, volume-mounted checkpoint):
docker build -t satquery-ai ./backend
docker run -p 8000:8000 -v $(pwd)/checkpoints:/workspace/checkpoints \
-e SATQUERY_CHECKPOINT=/workspace/checkpoints/final satquery-ai \
python -m uvicorn app.backend.main:app --host 0.0.0.0 --port 8000
- Pre-demo checklist:
/api/healthok →/api/modelreports the intended weights → one warm-up Analyze → confirm report downloads.
Frontend development doesn't wait for the trained checkpoint. Use the foundation fallback to build and test uploads, routing, loading states, evidence rendering, and reports while training runs in another Zellij tab.
Done criteria
- All three input modes return answers with traces on the demo machine
- Report JSON downloads and contains task/tool/latency/confidence (+ disclaimer when untrained)
-
tests/test_app.pypasses against the deployed build
Debug
| Symptom | Cause → fix |
|---|---|
| Blank page | static dir resolution (_FRONTEND_DIR) - run from backend/ with PYTHONPATH=. |
| First Analyze hangs | lazy model load - wait, then retry; pre-warm before demos |
| CORS errors (custom frontend origin) | main.py allows * by default - check you didn't deploy a modified copy |
| TIFF upload fails | rasterio/GDAL missing in env - nix develop or the Dockerfile's libgdal-dev path |
| Boxes don't draw | decoder output empty - verify with inference/generate.py --task grounding on the same image first |