crcsmnky / stocking-inventory

Proactively Stocking Inventory using Machine Learning

Home Page:https://cloud.withgoogle.com/next18/sf/sessions/session/155904

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proactively Stocking Inventory using ML

Background

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.

Architecture

Demo Architecture

Process Flow

  • 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 Inventory service
  • Inventory service sends image to Cloud Vision API
  • Based on Vision API response, Inventory sends message to a Pub/Sub topic
  • Cloud Pub/Sub push subscription to App Engine Messaging service
  • Messaging service uses Firebase Admin API to send device notification
  • Firebase delivers push notification to Staff App

Requirements

Deploying

App Engine

$ gcloud app deploy \
default-service/app.yaml \
inventory-service/app.yaml \
messaging-service/app.yaml

Cloud Storage and Cloud Pub/Sub

Edit setup.sh with the following information:

  • Cloud Storage bucket name (BUCKET_NAME)
  • App Engine endpoints (INVENTORY_ENDPOINT and MESSAGING_ENDPOINT)
$ ./setup.sh all up

Firebase

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]

About

Proactively Stocking Inventory using Machine Learning

https://cloud.withgoogle.com/next18/sf/sessions/session/155904

License:Apache License 2.0


Languages

Language:HTML 51.3%Language:Python 20.3%Language:Shell 14.3%Language:JavaScript 8.7%Language:CSS 5.4%