This quickstart steps you through the process of:
- Creating a Cloud Storage bucket.
- Uploading your image to Cloud Storage and making it public.
- Making a request to the Vision API with that image.
Before you begin
If you haven't done so already, set up your project and create a Google Cloud Storage bucket, as explained below.
Set up your project
Sign in to your Google account.
If you don't already have one, sign up for a new account.
- In the Cloud Platform Console, go to the Manage resources page and select or create a new project.
- Enable billing for your project.
- Enable the Cloud Vision API.
Create a Cloud Storage bucket
- In the Cloud Platform Console, go to the Cloud Storage browser.
- Click Create bucket.
- In the Create bucket dialog, specify the following attributes:
- Name: A unique bucket name. Do not include sensitive information in the bucket name, as the bucket namespace is global and publicly visible.
- Storage class: Multi-Regional
- A location where bucket data will be stored.
- Click Create.
Make a request to the Cloud Vision API service
demo-image.jpg. (You may need to right-click the link.)
Open the Cloud Platform Console Storage Browser, select a bucket, then click UPLOAD FILES and select the
demo-image.jpgfile to upload from your local machine to your Cloud Storage bucket. This is the image file that you just uploaded:
After the file is uploaded and listed in the Cloud Storage Browser, share the image publicly by clicking the
Public linkbox in the right column of the listing.
Complete the interactive API Explorer template, below, by replacing
image.source.imageUrifield with the name of the Cloud Storage bucket where you uploaded the
Click Execute to send the request to the service. After less than one second (typically), the JSON response appears above.
Congratulations! You've made your first
images.annotate request to the Cloud Vision API service.
To avoid unnecessary Google Cloud Platform charges, use the Cloud Platform Console to delete your Cloud Storage bucket (and your project) if you do not need them.