In this lab you use Machine Learning APIs from within Datalab.
In this lab, you learn how to invoke ML APIs from Python and use their results.
You must have completed Lab 0 and have the following:
In this lab, you will first
and then invoke ML APIs from Datalab to carry out some representative tasks:
ML APIs are microservices. When we build ML models ourselves, it should be our goal to make them so easy to use and stand-alone.
Go back into your Cloud Datalab tab.
In Cloud Datalab home page (browser), navigate into "notebooks" and add a new notebook using the icon on the top left.
Rename this notebook as ‘recheckout'.
In the new notebook, enter the following commands in the cell, and click on Run (on the top navigation bar) to run the commands:
%bash gcloud source repos clone asl-ml-immersion --project=asl-ml-immersion rm -rf asl-ml-immersion/.git
Confirm that you have cloned the repo by going back to Datalab browser, and ensure you see the asl-ml-immersion directory. All the skeleton files for all labs throughout this course are available in this directory.
In Datalab, click on the "Ungit" icon in the Datalab toolbar. Commit all your changes, including the files that you have pulled down. After commit, select master and click on Push.
To confirm that the cloned repo files have been saved into your project's source repositories, go into GCP console and using the menu, navigate to Source Repositories > Repositories. Next, click on "datalab-repositories" and verify that you have the asl-ml-immersion directory with code files in it.
To get an API key:
From the GCP console menu, select APIs and services and select Library
In the search box, type vision to find the Google Cloud Vision API and click on the hyperlink.
Click Enable if necessary
Follow the same process to enable Translate API, Speech API, and Natural Language APIs.
From the GCP console menu, select APIs and services and select Credentials.
If you do not already have an API key, click the Create credentials button and select API key. Once created, click close. You will need this API key in the notebook later.
In the Datalab browser, navigate to asl-ml-immersion > 1.2_googleml_soln > mlapis.ipynb
Read the commentary, then run the Python snippets (Use Shift+Enter to run each piece of code) in the cell, step by step. Make sure to insert your API Key in the first Python cell.
©Google, Inc. or its affiliates. All rights reserved. Do not distribute.