This is the FINAL lesson of Machine Learning APIs!!!
Time flies!!!
This lesson is quite interesting.
We add in Kubernetes to make this course more practical.
Don't worry! We are going to guide you steps by steps.
The Awwvision lab uses Kubernetes and Cloud Vision API to demonstrate how to use the Vision API to classify (label) images from Reddit's /r/aww subreddit and display the labelled results in a web app.
Awwvision has three components:
Open Google Cloud Platform ( follow the step in A Tour of Qwiklabs and Google Cloud )
Activate Cloud Shell
Like what we did in the previous lesson.
Create a Kubernetes Engine cluster
We will use gcloud, Google Cloud's command-line tool, to set up a Kubernetes Engine cluster. The cloud platform scope is used to allow access to the Pub/Sub and Vision APIs.
Create a cluster in the us-central1-a zone:
gcloud config set compute/zone us-central1-a
Start up the cluster:
gcloud container clusters create awwvision \
--num-nodes 2 \
--scopes cloud-platform
Use the container's credentials:
gcloud container clusters get-credentials awwvision
Verify that everything is working using the kubectl command-line tool:
kubectl cluster-info
Download and update the packages list:
sudo apt-get update
Python virtual environments are used to isolate package installation from the system:
sudo apt-get install virtualenv
Do you want to continue? [Y/n]: Y
virtualenv -p python3 venv
Activate the virtual environment:
source venv/bin/activate
Add sample data to our project:
git clone https://github.com/GoogleCloudPlatform/cloud-vision
Change to the python/awwvision directory in the cloned cloud-vision repo:
cd cloud-vision/python/awwvision
Once in the awwvision directory, run make all to build and deploy everything:
make all
As part of the process, Docker images will be built and uploaded to the Google Container Registry private container registry. In addition, yaml files will be generated from templates, filled in with information specific to your project, and used to deploy the redis, webapp, and worker Kubernetes resources for the lab.
List the pods:
kubectl get pods
Make sure all of your pods have a Running before executing the next command:
List the deployments:
kubectl get deployments -o wide
You can see the number of replicas specified for each, and the images used:
Once deployed, get the external IP address of the webapp service by running:
kubectl get svc awwvision-webapp
Assigned external IP to be listed:
Copy and paste the external IP of the awwvision-webapp service from the above result into a new browser to open the webapp, then click Start the Crawler button.
You will see images from the /r/aww subreddit classified by the labels provided by the Vision API.
If you see some of the images classified multiple times, it's because multiple labels are detected for them.
HOORAY!!!!! We finish Machine Learning APIs course!!!!!
Such a great accomplishment right!!!
It's quite tedious at first, but once you started doing with others together, the path no longer gave you harshness.
Hope you enjoy today's sharing ~