From 5af5fe416f2a07911ea1caa23e84e8c3c5baffd1 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Wed, 12 Apr 2017 14:33:06 -0700 Subject: [PATCH] Bring ML APIs up to standard. (#346) --- .../google-cloud-vision/samples/README.md | 40 ++++++++++++------- .../google-cloud-vision/samples/package.json | 14 +++---- .../google-cloud-vision/samples/quickstart.js | 3 ++ 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/packages/google-cloud-vision/samples/README.md b/packages/google-cloud-vision/samples/README.md index 411c81a621f..4b5688b3562 100644 --- a/packages/google-cloud-vision/samples/README.md +++ b/packages/google-cloud-vision/samples/README.md @@ -37,20 +37,26 @@ __Usage:__ `node detect.js --help` ``` Commands: - faces Detects faces in a local image file. - faces-gcs Detects faces in an image in Google Cloud Storage. - labels Detects labels in a local image file. - labels-gcs Detects labels in an image in Google Cloud Storage. - landmarks Detects landmarks in a local image file. - landmarks-gcs Detects landmarks in an image in Google Cloud Storage. - text Detects text in a local image file. - text-gcs Detects text in an image in Google Cloud Storage. - logos Detects logos in a local image file. - logos-gcs Detects logos in an image in Google Cloud Storage. - properties Detects image properties in a local image file. - properties-gcs Detects image properties in an image in Google Cloud Storage. - safe-search Detects safe search properties in a local image file. - safe-search-gcs Detects safe search properties in an image in Google Cloud Storage. + faces Detects faces in a local image file. + faces-gcs Detects faces in an image in Google Cloud Storage. + labels Detects labels in a local image file. + labels-gcs Detects labels in an image in Google Cloud Storage. + landmarks Detects landmarks in a local image file. + landmarks-gcs Detects landmarks in an image in Google Cloud Storage. + text Detects text in a local image file. + text-gcs Detects text in an image in Google Cloud Storage. + logos Detects logos in a local image file. + logos-gcs Detects logos in an image in Google Cloud Storage. + properties Detects image properties in a local image file. + properties-gcs Detects image properties in an image in Google Cloud Storage. + safe-search Detects safe search properties in a local image file. + safe-search-gcs Detects safe search properties in an image in Google Cloud Storage. + crops Detects crop hints in a local image file. + crops-gcs Detects crop hints in an image in Google Cloud Storage. + web Finds similar photos on the web for a local image file. + web-gcs Finds similar photos on the web for an image in Google Cloud Storage. + fulltext Extracts full text from a local image file. + fulltext-gcs Extracts full text from an image in Google Cloud Storage. Options: --help Show help [boolean] @@ -70,6 +76,12 @@ Examples: node detect.js properties-gcs my-bucket your-image.jpg node detect.js safe-search ./resources/wakeupcat.jpg node detect.js safe-search-gcs my-bucket your-image.jpg + node detect.js crops ./resources/wakeupcat.jpg + node detect.js crops-gcs my-bucket your-image.jpg + node detect.js web ./resources/wakeupcat.jpg + node detect.js web-gcs my-bucket your-image.jpg + node detect.js fulltext ./resources/wakeupcat.jpg + node detect.js fulltext-gcs my-bucket your-image.jpg For more information, see https://cloud.google.com/vision/docs ``` diff --git a/packages/google-cloud-vision/samples/package.json b/packages/google-cloud-vision/samples/package.json index 18d9189f914..2bac2fbb1f5 100644 --- a/packages/google-cloud-vision/samples/package.json +++ b/packages/google-cloud-vision/samples/package.json @@ -8,15 +8,15 @@ "test": "cd ..; npm run st -- --verbose vision/system-test/*.test.js" }, "dependencies": { - "@google-cloud/storage": "0.7.0", - "@google-cloud/vision": "^0.11.0", - "async": "2.1.4", - "natural": "0.4.0", - "redis": "2.6.5", - "yargs": "6.6.0" + "@google-cloud/storage": "1.0.0", + "@google-cloud/vision": "0.11.0", + "async": "2.3.0", + "natural": "0.5.0", + "redis": "2.7.1", + "yargs": "7.0.2" }, "optionalDependencies": { - "canvas": "1.6.2" + "canvas": "1.6.5" }, "engines": { "node": ">=4.3.2" diff --git a/packages/google-cloud-vision/samples/quickstart.js b/packages/google-cloud-vision/samples/quickstart.js index e650314dbdf..16afa9a4078 100644 --- a/packages/google-cloud-vision/samples/quickstart.js +++ b/packages/google-cloud-vision/samples/quickstart.js @@ -37,5 +37,8 @@ visionClient.detectLabels(fileName) console.log('Labels:'); labels.forEach((label) => console.log(label)); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END vision_quickstart]