Proactively Stocking Inventory using ML
How do you notify store associates when items are out of stock? What if you could leverage footage from in-store cameras to detect when stock is low for items that have a quick turnover (like produce) and have those refilled before running out?
In this session from Google Cloud Next 2018, we walked through an architecture that describes how to combine camera footage, the Cloud Vision API, and Firebase to deliver an end-to-end use case to help shoppers get the products they need without having to wait.
- Images are uploaded to a Cloud Storage bucket
- Cloud Storage bucket notifications are sent to a Cloud Pub/Sub topic
- Cloud Pub/Sub push subscription sends message to App Engine
Inventoryservice sends image to Cloud Vision API
- Based on Vision API response,
Inventorysends message to a Pub/Sub topic
- Cloud Pub/Sub push subscription to App Engine
Messagingservice uses Firebase Admin API to send device notification
- Firebase delivers push notification to
$ gcloud app deploy \ default-service/app.yaml \ inventory-service/app.yaml \ messaging-service/app.yaml
Cloud Storage and Cloud Pub/Sub
setup.sh with the following information:
- Cloud Storage bucket name (
- App Engine endpoints (
$ ./setup.sh all up
In the Firebase console for your project, navigate to Project Settings > Cloud Messaging and create a new Web Push certificate. Next copy the Key pair and paste it into
messaging.usePublicVapidKey() in staff-app/index.html.
$ cd staff-app $ firebase deploy
Once the Firebase app has been deployed, navigate to it and generate a new push token. Copy that token and run the following:
$ ./update-metadata.sh [TOKEN]