← Showcases

Interactive AI Vision Lens

About & Code

Standalone App & PWA

Opens on its own origin so you can install it as a standalone desktop/mobile PWA (uses its own separate local model cache).

Open lens.webai.show ↗

Staying on webai.show shares Depth Anything v2, YOLOS-Tiny & Table Transformer weights across all showcases.

1. Choose an AI Vision Lens

Scene: Architectural Cityscape (960×600 procedural canvas)

Ready — download or initialise the active model above to light up the AI lens.

Depth · awaiting model

Tip: Drag on the canvas, touch-drag on mobile, or focus the lens ring and nudge with Arrow keys (Shift+Arrow faster, +/- size, Enter full-frame reveal).

135 px
model Depth Anything v2 Small backend WASM (q8) load – inference – lens (480, 312) · r=135px

Inside the Lens — Depth X-Ray

Load Depth Anything v2 Small above to run real local inference on this scene.

signature showcase · vision · transformers.js 3.7.5 · 3 local ONNX models

Drag a tactile spotlight lens across any scene — or upload your own photo — to peer inside what three distinct on-device neural networks actually see: monocular depth, object radar, and table structure geometry, running 100% locally in isolated Web Workers.

The Engineering Question

Can a single direct-manipulation lens interface switch smoothly between Depth Anything v2, YOLOS-Tiny, and Table Transformer Structure v1.1-all on the visitor's device — keeping 60 fps pointer & keyboard scrubbing off the main thread, honestly reporting real timings, and cleanly releasing each model's WASM memory on demand?

</> Show the code — inspect worker.js & lens.js lazy-loaded · zero CLS
Open this panel to fetch the exact ES module source running on this page.

Findings & Engineering Notes

One Neural Pass, 60 fps Tactile Scrubbing

Running an ONNX vision encoder on every pointer move would starve the UI. Instead, each (scene, lens) pair runs once in a dedicated Web Worker; dragging or nudging the lens updates registered CSS custom properties (--lens-x, --lens-y, --lens-r) and reads precomputed tensors/boxes in microseconds.

Isolated Workers Enable Real Memory Release

Each lens spawns its own worker and registers a dispose() callback with the shared createModelLoader. Clicking Release from memory calls pipe.dispose() and terminates that lens's worker, reclaiming its WASM heap while preserving cached weights in Cache Storage.

Zero Bundled Assets + Local Photo Privacy

The three default scenes are drawn deterministically on a <canvas> at runtime — zero raster downloads. When you upload your own photograph, it is resized locally in memory and passed directly to the worker without leaving your browser.

Honest Trade-Offs on Procedural vs. Natural Photos

Procedural scenes make depth planes and financial table grids cleanly testable out of the box, while COCO-trained yolos-tiny shines brightest on natural photographs with real-world textures and lighting. Try uploading a photo of your own desk to compare.