# TASK: Deploy Annotation Review Tool as Public Web App **Priority:** MEDIUM **Agent:** engineer **Filed:** 2026-02-20 **Filed by:** Doug (via Claude Code session) ## Goal Turn the Annotator web review interface into a publicly accessible web app so anyone can review auto-annotated field photos from any browser. Currently it's a local Flask dev server — needs to be production-ready on the Pi with Tailscale Funnel. ## Current State - Web review UI exists at `/data/Sandbox/Annotator/web_review/` (app.py, review.html, review.js) - 700 ground-level HEIC field photos at `/data/gdrive/FarmTech/FarmDefender/Field pics/Weeds/` - HSV auto-annotator produces 96,907 detections across those 700 images (~138 per image) - UI works but was only tested locally — needs production hardening - Images are HEIC format (iPhone) — browsers can't display HEIC natively - Auto-annotator runs on-demand per image (~2 sec per HEIC) — too slow for web ## What Needs to Happen ### 1. Pre-process images for web serving - Convert all 700 HEIC images to JPG (web-friendly) - Generate web-sized versions (max 1920px wide) for fast loading - Store in `/data/Sandbox/Annotator/web_review/processed/` or similar - Keep original HEIC paths mapped for YOLO training export later ### 2. Pre-compute all detections - Run HSV auto-annotator across all 700 images at sensitivity 5 - Cache results in a JSON file (detections.json) so the web app doesn't re-run on every page load - Include detection count per image for stats ### 3. Add simple token authentication - URL-based token: `?token=XXXXX` or simple login page - Generate a random token, store in config - Reject all requests without valid token - Keep it simple — no user accounts, just a shared access token ### 4. Set up Tailscale Funnel - Enable `tailscale funnel 5100` for public HTTPS access - URL will be: `https://agentpi.tail09c8d2.ts.net/` - Add as systemd service so it persists across reboots ### 5. Harden the Flask app for production - Serve pre-processed JPGs instead of raw HEICs - Load cached detections instead of running auto-annotator on demand - Add CORS headers if needed - Add proper error handling - Use gunicorn or similar instead of Flask dev server - Run as systemd service (annotator-review.service) on port 5100 ### 6. UI improvements (from Doug's testing session) - The keyboard shortcuts overlay and info overlay have been REMOVED (they covered small images) - Images should scale up to fill the viewer area (not stay postage-stamp sized) - Add image preloading (fetch next image while reviewing current) - Show progress bar (X of 700 reviewed) ## Key Files - `/data/Sandbox/Annotator/web_review/app.py` — Flask app (204 lines) - `/data/Sandbox/Annotator/web_review/templates/review.html` — UI template - `/data/Sandbox/Annotator/web_review/static/review.js` — Client JS - `/data/Sandbox/Annotator/auto_annotators/hsv_green.py` — Detection engine - `/data/Sandbox/Annotator/profiles/weed.json` — HSV config ## DO NOT - Do NOT delete or overwrite existing review_status.json files - Do NOT modify the core auto_annotators/ code — just use it - Do NOT send any emails about this - Do NOT use the comms agent - Do NOT over-engineer auth — a simple shared token is fine - Do NOT change the detection algorithm — just cache its output ## Output Expected 1. Pre-processed JPG images ready for web serving 2. Cached detections.json with all 96K+ detections 3. Systemd service file for the web app 4. Tailscale Funnel configured 5. Working public URL that Doug can access from any browser 6. Simple auth token documented in output