This code pattern discusses a way to create a progressive web application for mobile platforms that lets users classify images selected locally or taken with their mobile device’s camera. The app allows users to run a model offline in areas where internet connectivity might be sparse or nonexistent.
After creating deep learning models, users want to be able to deploy their trained models in their own applications. There are several ways to do this, and how you do it depends largely on your use cases and requirements. One requirement is the ability to run a model offline in areas where internet connectivity might be sparse or nonexistent. The solution for this is to create native apps for mobile platforms that package and load a compressed version of your models. However, this has the overhead of needing developers with expertise in Android and iOS development.
With this solution:
- Data remains on-device and classification is performed locally
- Assets are stored in a browser cache and storage
- App can run on desktops and be ‘installed’ on mobile devices
- Content can still be updated by prompting the user
- A pre-trained Keras/TensorFlow model is converted to the TensorFlow.js web-friendly format and integrated with the app.
- The user launches the progressive web application.
- The app assets and TensorFlow.js model files are downloaded from the web.
- The assets and model are stored locally using the browser’s cache and IndexedDB storage.
- The user takes a photo with a device camera or selects a local image.
- The image is sent through the model for inference and top predictions are given.
Find the detailed steps for this pattern in the README. Those steps show you how to:
- Clone the repository.
- Install the app dependencies.
- Download and convert the pre-trained model.
- Set up the configuration files.
- Deploy the app and classify the images.