Browser AI / Learning
Train a Tiny AI
Draw it. Teach it. Test it. An approachable AI lesson that puts learning directly in your hands.
- React
- TypeScript
- ONNX Runtime Web
- WebNN / WebGPU
- Python
What I contributed
Built the drawing, teaching and prediction flow, integrated local ONNX inference, and packaged the runtime for offline use.
What came out of it
A self-contained browser experience with live predictions and an explicit display of the active compute backend.
Let people teach the model themselves.
Machine learning is easier to understand when a learner can change the examples and see the effect. I built Train a Tiny AI for a STEM-booth setting, where visitors draw shapes or symbols, label their examples and test new drawings.
The app is designed to run offline after a one-time installation. That makes the lesson practical in a booth setting and keeps its central interaction independent of a cloud service.
Two pathways, two different lessons.
The teachable pathway uses a small nearest-neighbour classifier built from the visitor’s drawings. A separate pretrained ONNX Shape Sorter recognises circles, triangles, squares and stars. The first makes training tangible; the second introduces how an existing model can run on available hardware.
My work connects the canvas, examples and predictions into a clear learning flow. I also integrated ONNX Runtime Web and the locally packaged model and runtime files, so inference does not require a CDN.
Detect capability, then use it.
Accelerator availability depends on the browser, hardware and runtime. The application attempts available WebNN and WebGPU backends, verifies a usable session, and falls back to the CPU when acceleration cannot run.
The active backend is shown in the interface. The model running on an accelerator is the pretrained Shape Sorter; the visitor-trained classifier is a separate pathway. Making that distinction explicit keeps the demonstration understandable.
A small interface for a big idea.
The result is a local drawing-and-prediction experience with a reproducible offline setup and a Python tool for regenerating the shape model. Learners can compare examples and predictions rather than simply watching a prepared animation.
This is an independent public learning project with an AMD theme. It illustrates machine-learning concepts and browser inference; it is separate from my semiconductor product development work.