Skip to content
Offline handwritten digit recognition
TypeScript HTML CSS JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
static/models
.gitignore
LICENSE
README.md
index.html
index.ts Upgrade to tfjs 1.x Aug 4, 2019
package-lock.json
package.json
predict.ts
style.css
sw.js
tsconfig.json
tslint.json

README.md

Offline handwritten digit recognition

This small web app aims to demonstrate how machine learning models can be used completely offline.

While the web resources (HTML, CSS and JS) are cached using a service worker, the model and its weights are saved into IndexedDB using TensorFlow.js. They are loaded from there wherever possible, while falling back to the network if not found (for example, when the user clears the site data).

This way, after the first successful load on a modern browser, all resources are available even without a network connection.

The model has been trained using the mnist-node example code in tfjs-examples repository.

Running the code

You need to have Node.js installed. In the project root directory, run these commands:

npm install
npm start

Creating a minified build

Assuming you have run npm install previously:

npm run build
You can’t perform that action at this time.