Skip to content

Latest commit

 

History

History
 
 

detect

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Google Cloud Vision API Go example

Authentication

  • Create a project with the Google Cloud Console, and enable the Vision API.

  • From the Cloud Console, create a service account, download its json credentials file, then set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json

Run the sample

To build and run the sample:

go run detect.go main.go ../testdata/cat.jpg

go run detect.go main.go gs://...

go run detect.go main.go https://...

Modifiying the source code

Do not edit the detect.go file directly. In order to modify it edit the code at vision/detect/generated/sample-template.go and run go generate at the command line:

cd vision/detect
go generate