joemccann / basic-cloud-vision-api-nodejs

Node.js demo for Google Cloud Vision and face detection.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic Cloud Vision API Demo with Node.js

DISCLAIMER

DO NOT USE THIS FOR PRODUCTION USE.

This is only for demonstration/learning purposes.

Installation

npm i

You'll need to create a service-key.json file and save it in this root directory. You get it from your authentication/permissions settings in your Google Cloud Account.

Read more here:

https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/docs/authentication.md

Set your Google Cloud Project ID:

export GCLOUD_PROJECT=your-app-project-id-change-this-value

Usage

node face img/joe-at-le-labo.jpg output/joe-highlighted.jpg

The above command will take the file joe-at-le-labo.jpg in the img directory and save a highlighted image in the output directory with the file name joe-highlighted.jpg.

1337 H4x0r Tip for Mac Users

Since it takes some to connect over the network and use the actual image API, run this on your Mac:

(time node face img/joe-at-le-labo.jpg output/joe-highlighted.jpg && say done) || say error

This way you can let it run for how ever long it needs to take, check reddit, and then be notified when it's done or has an error.

You can also see how long it takes with the time function.

License

MIT

About

Node.js demo for Google Cloud Vision and face detection.

License:MIT License