Recognize handwritten digits with a custom model

A small neural network (64 → 25 → 10, about 1,900 weights in digits-mlp.bin) classifies 8×8 digit images. When you press Recognize, a Web Worker downloads the weights (from the Cache API on later runs), creates a WebGPU device, uploads the weights as f16 when shader-f16 is supported, and runs both layers in compute shaders. Without WebGPU, or after a GPU error or device loss, the worker runs the same layers on the CPU.

Draw a large digit that fills the box, or load a sample from the test set:

The model loads when you press Recognize for the first time.