---
title: "Making ML-powered web games with Transformers.js"
description: "Doodle Dash is a Quick, Draw!-style sketch-guessing game that runs entirely in the browser, using a MobileViT-small model (5.6M parameters, ~20 MB) fine-tuned on Google's Quick, Draw! dataset."
url: "https://swe.quest/articles/making-ml-powered-web-games-with-transformers-js-c633a2c1d80dea56"
canonical: "https://huggingface.co/blog/ml-web-games"
source: "Hugging Face"
published: "2023-07-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["inference","computer-vision","javascript","gaming","frontend"]
---

# Making ML-powered web games with Transformers.js

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-07-05, 8 min read, How-to. Original: [https://huggingface.co/blog/ml-web-games](https://huggingface.co/blog/ml-web-games)

## Summary

Doodle Dash is a Quick, Draw!-style sketch-guessing game that runs entirely in the browser, using a MobileViT-small model (5.6M parameters, ~20 MB) fine-tuned on Google's Quick, Draw! dataset. The model is converted to ONNX with Optimum and run via Transformers.js in a Web Worker so inference doesn't block the UI, producing over 60 predictions per second with no server latency. The game loop is redesigned around that real-time speed: players draw as many prompts as they can in 60 seconds, and scores for early incorrect labels are progressively suppressed. Ambiguous or hard-to-draw classes were pruned, leaving over 300 categories.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Games](https://swe.quest/tags/gaming.md) (Domains)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- React basics ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Hugging Face Transformers
- Web Workers

## Keywords

Transformers.js, ONNX Runtime, MobileViT, Quick, Draw!, Optimum, Web Workers, Vite

## Related posts

- [Create an infinite icon library by fine-tuning Stable Diffusion](https://swe.quest/articles/create-an-infinite-icon-library-by-fine-tuning-stable-diffusion-bfc1ceb5caaf1412.md): Modal · 2024-05-21 · Medium · 12 min read · Model training, Computer vision, Inference & serving, Serverless, Python
  Stable Diffusion v1.5 is fully fine-tuned on the ~300-icon Heroicons set to generate new icons in a similar black-and-white line style.
- [Timm ❤️ Transformers: Use any timm model with transformers](https://swe.quest/articles/timm-transformers-use-any-timm-model-with-transformers-ae757824718fc026.md): Hugging Face · 2025-01-16 · Medium · 10 min read · Computer vision, Model training, Inference & serving, Python
  TimmWrapper lets any timm vision model load through Hugging Face transformers' Auto classes and pipeline API.
- [Making a web app generator with open ML models](https://swe.quest/articles/making-a-web-app-generator-with-open-ml-models-3da427bd1ac5acd0.md): Hugging Face · 2023-07-03 · Medium · 9 min read · LLMs, AI for coding, JavaScript, Inference & serving
  A Node.js/Express server can generate web apps from a text prompt by streaming tokens from a code LLM (WizardCoder-15B on Hugging Face Inference Endpoints) straight into the browser as HTML.
- [Transformers.js v3: WebGPU Support, New Models & Tasks, and More…](https://swe.quest/articles/transformers-js-v3-webgpu-support-new-models-tasks-and-more-3627acdd60e7ffe6.md): Hugging Face · 2024-10-22 · Medium · 11 min read · Inference & serving, JavaScript, Browsers, Machine learning
  Transformers.js v3 adds WebGPU acceleration via ONNX Runtime Web, claimed up to 100x faster than WASM and enabled by passing \`device: 'webgpu'\` when loading a pipeline.
- [Transformers.js v4: Now Available on NPM!](https://swe.quest/articles/transformers-js-v4-now-available-on-npm-60e5d316d3e108bd.md): Hugging Face · 2026-02-09 · Medium · 7 min read · Inference & serving, JavaScript, LLMs, Browsers, Build systems
  Transformers.js v4 ships on NPM with a new C++ WebGPU runtime built with the ONNX Runtime team, enabling WebGPU-accelerated models in browsers as well as Node, Bun and Deno.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
