Skip to main content

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.py serves / (static index.html) and POST /api/analyze; model loads lazily once via get_pipeline().
  • Without SATQUERY_CHECKPOINT, the app builds foundation weights (SATQUERY_LLM default Qwen/Qwen3-0.6B, SATQUERY_VISION SigLIP-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​

  1. 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
  1. Open http://localhost:8000, upload image(s), type query, Analyze. Expect: answer, boxes/points on canvas, confidence bar, execution trace, downloadable JSON report.
  2. 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
  1. Pre-demo checklist: /api/health ok → /api/model reports 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.py passes against the deployed build

Debug​

SymptomCause → fix
Blank pagestatic dir resolution (_FRONTEND_DIR) - run from backend/ with PYTHONPATH=.
First Analyze hangslazy 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 failsrasterio/GDAL missing in env - nix develop or the Dockerfile's libgdal-dev path
Boxes don't drawdecoder output empty - verify with inference/generate.py --task grounding on the same image first