One Click Tensorflow.js with Azure!!!

Click the deploy button to get started!

TL;DR The release of Tensorflow.js (TFJS) enables state of the Art AI in the browser with just a few lines of code but how do we get this in the hands of our users? This post outlines how to get started serving your TFJS models and applications on the cloud with just one click.

What is Tensorflow.JS?

Pos detection in the browser using Tensoflow.js

TensorFlow.js, is an open-source library you can use to define, train, and run machine learning models entirely in the browser, using Javascript and a high-level layers API.

With just a few lines of code TFJS enables you to:

  • Import existing, pre-trained tensorflow models for inference
  • Preform transfer learning with pre-trained models on custom data
  • Author models directly in the browser.

Once you have a working app you may be thinking how can I best serve this to my users. The Azure WebApp Container Service and ARM templates make it easy to serve scale-able web apps from docker with just one click.

Prerequisites:

  • Azure Subscription (you can get a free one here)
  • Docker/Dockerhub
  • Git

Getting started:

  1. Create a Dockerfile a docker container for your application.
  2. Build and push your docker container to DockerHub.
  3. Fork and Clone TensorflowJS4Azure to a local directory
  4. Replace the following to align with your application
“properties”: { “WEBSITES_PORT”:1234,
“DOCKER_CUSTOM_IMAGE_NAME”: “abornst/tfjs4azure”,
“DOCKER_CUSTOM_IMAGE_RUN_COMMAND”: “abornst/tfjs4azure” }

5. Push your changes and like magic the deploy to azure button on your forked repo will now deploy your app with one click.

Conclusion

There you have it, a production web app that serves your tensorflow.js web app on azure to any subscription with just one click. This approach can be used to easily serve any light weight website using docker as well!