Skip to content

Command-line tool for interacting with the Google Cloud Vision API

Notifications You must be signed in to change notification settings

marcjoha/visionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

visionary.py

A cmdline tool for interacting with the Google Cloud Vision API. Useful for bulk jobs.

Set up a GCP project

  • 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

Set up visionary.py

  • Preferred: set up an isolated Python environment. Note: On OS X El Capitain this is required or else you will get dependency issues for the package six.
  • Install dependencies using pip install -r requirements.txt

Examples

Read the help page:

python visionary.py --help

Apply all detection types to a local file:

python visionary.py myimage.jpg

Apply all detection types to remote file accessible over HTTP:

python visionary.py http://www.example.com/myimage.jpg

Apply all detection types to an image on Cloud Storage:

python visionary.py gs://mybucket/myimage.jpg

Apply face detection only (see --help for all types) to an image on Cloud Storage:

python visionary.py -t face_detection gs://mybucket/myimage.jpg

Bulk load images in the local directory 'input' and write output to files suffixed with ".json" in the local directory 'output':

find input -type f | python visionary.py -o output

Bulk load images from Cloud Storage and write output to files suffixed with ".json" in the local directory 'output':

gsutil ls gs://mybucket/ | python visionary.py -o output

About

Command-line tool for interacting with the Google Cloud Vision API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages