Integrate with Machine Learning APIs: Challenge Lab

Challenge Scenario

SELECT locale,COUNT(locale) as lcount FROM image_classification_dataset.image_text_detail GROUP BY locale ORDER BY lcount DESCcontent_copy

1.Configure a service account to access the Machine Learning APIs, BigQuery, and Cloud Storage

export PROJECT=qwiklabs-gcp-00-c1a4e49284be
gcloud iam service-accounts create my-account --display-name my-account
gcloud iam service-accounts create PROJECT
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:my-account@$PROJECT.iam.gserviceaccount.com --role=roles/bigquery.admin
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:my-account@$PROJECT.iam.gserviceaccount.com --role=roles/storage.admin

2.Create and download a credential file for your Service Account

gcloud iam service-accounts keys create key.json --iam-account=my-account@$PROJECT.iam.gserviceaccount.comexport GOOGLE_APPLICATION_CREDENTIALS=key.json
gsutil cp gs://$PROJECT/analyze-images.py .

4.Modify the Python script to translate the text using the Translation API

python3 analyze-images.py $DEVSHELL_PROJECT_ID $DEVSHELL_PROJECT_ID

5.Identify the most common non-English language used in the signs in the data set

SELECT locale,COUNT(locale) as lcount FROM image_classification_dataset.image_text_detail GROUP BY locale ORDER BY lcount DESC

Congratulations! Done with the challenge lab.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store