Classify objects or areas within an image by drawing a crop around them.
Everything runs locally in the browser: image decoding, cropping, model inference, and result generation. Your images and selected regions are not uploaded to an inference server.
- Open an image.
- Draw a box around the area you want to classify.
- Run the model.
- Review the result and repeat with another region if needed.
The application uses the ONNX version of LFM2.5-VL-450M published by ONNX Community.
You will need:
- A browser with WebGPU support (
shader-f16is optional) - Enough browser storage for the model files and runtime cache
- Node.js 22 or newer
- Corepack
Corepack is included with Node.js 22–24. On newer Node.js releases, you may need to install it separately.
Browsers with shader-f16 use the configured mixed-precision WebGPU profile. Other WebGPU adapters use an all-Q8 CPU/WASM profile, which downloads about 630.7 MB of Q8 ONNX artifacts plus configuration and tokenizer files. Performance depends on the selected backend, browser, GPU/CPU, available memory, and selected region.
Install the dependencies:
corepack enable
corepack pnpm installStart the development server:
corepack pnpm run devOpen the address printed by Vite.
The first model load can take longer because the browser needs to download and cache the model files.
Run the complete project check before submitting a change:
corepack pnpm run checkYou can also run the repository checks separately:
node scripts/verify-model-manifest.mjs
node scripts/measure-codebase.mjsThe individual checks validate the pinned model files and measure the codebase.
See package.json for the complete list of commands and dependencies.
Create a production build:
corepack pnpm run buildPreview it locally:
corepack pnpm run startThe generated static site is written to dist/.
Vite is configured to use relative asset paths, so the build can be hosted at either a domain root or a nested path.
Model configuration is pinned in model-manifest.json, including:
- the Hugging Face revision;
- ONNX artifacts;
- runtime options;
- integrity information.
Update the manifest whenever the model revision or runtime configuration changes.
The inference path uses:
- Transformers.js for model loading and preprocessing
- ONNX Runtime Web for browser inference
- WebGPU when
shader-f16is available, otherwise ONNX Runtime Web WASM with Q8 artifacts
The interface is built with React and Mantine. XState manages application state, Comlink handles worker communication, Valibot validates data, and react-image-crop provides region selection.
For a detailed description of the inference flow, see docs/browser-inference.md.