Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/vision

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/vision - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

src/v1/image_annotator_api.js

10

package.json
{
"name": "@google-cloud/vision",
"version": "0.6.1",
"version": "0.6.2",
"author": "Google Inc.",

@@ -53,7 +53,7 @@ "description": "Google Cloud Vision Client Library for Node.js",

"dependencies": {
"@google-cloud/common": "^0.11.0",
"@google-cloud/common": "^0.8.0",
"arrify": "^1.0.0",
"async": "^2.0.1",
"extend": "^3.0.0",
"google-gax": "^0.10.0",
"google-gax": "^0.9.1",
"google-proto-files": "^0.8.0",

@@ -68,3 +68,3 @@ "is": "^3.0.1",

"@google-cloud/storage": "*",
"deep-strict-equal": "^0.2.0",
"deep-strict-equal": "^0.1.0",
"mocha": "^3.0.1",

@@ -75,3 +75,3 @@ "multiline": "^1.0.2",

"proxyquire": "^1.7.10",
"tmp": "^0.0.31"
"tmp": "0.0.27"
},

@@ -78,0 +78,0 @@ "scripts": {

@@ -1,4 +0,6 @@

# @google-cloud/vision ([Alpha][versioning])
# @google-cloud/vision
> Google Cloud Vision Client Library for Node.js
> **This is a Beta release of Google Cloud Vision.** This feature is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes.
*Looking for more Google APIs than just Vision? You might want to check out [`google-cloud`][google-cloud].*

@@ -125,8 +127,14 @@

### On Google Cloud Platform
### On Google Compute Engine
If you are running this client on Google Cloud Platform, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
If you are running this client on Google Compute Engine, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
``` js
var vision = require('@google-cloud/vision')();
// Authenticating on a global basis.
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123'
var vision = require('@google-cloud/vision')({
projectId: projectId
});
// ...you're good to go!

@@ -137,3 +145,3 @@ ```

If you are not running this client on Google Cloud Platform, you need a Google Developers service account. To create a service account:
If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account:

@@ -165,3 +173,2 @@ 1. Visit the [Google Developers Console][dev-console].

[versioning]: https://github.com/GoogleCloudPlatform/google-cloud-node#versioning
[google-cloud]: https://github.com/GoogleCloudPlatform/google-cloud-node/

@@ -168,0 +175,0 @@ [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using

@@ -42,2 +42,8 @@ /*!

/**
* <p class="notice">
* **This is a Beta release of Google Cloud Vision.** This API is not covered
* by any SLA or deprecation policy and may be subject to backward-
* incompatible changes.
* </p>
*
* The [Cloud Vision API](https://cloud.google.com/vision/docs) allows easy

@@ -832,9 +838,9 @@ * integration of vision detection features, including image labeling, face and

* // confidence: 56.748849,
* // anger: false,
* // blurred: false,
* // headwear: false,
* // joy: false,
* // sorrow: false,
* // surprise: false,
* // underExposed: false
* // blurry: false,
* // dark: false,
* // happy: false,
* // hat: false,
* // mad: false,
* // sad: false,
* // surprised: false
* // }

@@ -1343,2 +1349,32 @@ * // ]

/**
* Convert an object with "likelihood" values to a boolean-representation, based
* on the lowest likelihood provided.
*
* @private
*
* @example
* Vision.convertToBoolean_(Vision.likelihood.VERY_LIKELY, {
* blurry: 'POSSIBLE'
* });
* // { blurry: false }
*
* Vision.convertToBoolean_(Vision.likelihood.UNLIKELY, {
* blurry: 'POSSIBLE'
* });
* // { blurry: true }
*/
Vision.convertToBoolean_ = function(baseLikelihood, object) {
var convertedObject = {};
for (var prop in object) {
if (object.hasOwnProperty(prop)) {
var value = Vision.likelihood[object[prop]];
convertedObject[prop] = value >= baseLikelihood;
}
}
return convertedObject;
};
/**
* Determine the type of image the user is asking to be annotated. If a

@@ -1556,13 +1592,12 @@ * {module:storage/file}, convert to its "gs://{bucket}/{file}" URL. If a remote

// Remove the `Likelihood` part from a property name.
// input: "joyLikelihood", output: "joy"
for (var prop in faceAnnotation) {
if (prop.indexOf('Likelihood') > -1) {
var shortenedProp = prop.replace('Likelihood', '');
extend(formattedFaceAnnotation, Vision.convertToBoolean_(LIKELY, {
blurry: faceAnnotation.blurredLikelihood,
dark: faceAnnotation.underExposedLikelihood,
happy: faceAnnotation.joyLikelihood,
hat: faceAnnotation.headwearLikelihood,
mad: faceAnnotation.angerLikelihood,
sad: faceAnnotation.sorrowLikelihood,
surprised: faceAnnotation.surpriseLikelihood
}));
formattedFaceAnnotation[shortenedProp] =
Vision.gteLikelihood_(LIKELY, faceAnnotation[prop]);
}
}
return formattedFaceAnnotation;

@@ -1616,7 +1651,3 @@ };

if (!options.verbose) {
for (var prop in ssAnnotation) {
var value = ssAnnotation[prop];
ssAnnotation[prop] = Vision.gteLikelihood_(LIKELY, value);
}
return ssAnnotation;
return Vision.convertToBoolean_(LIKELY, ssAnnotation);
}

@@ -1627,19 +1658,2 @@

/**
* Convert a "likelihood" value to a boolean representation, based on the lowest
* likelihood provided.
*
* @private
*
* @example
* Vision.gteLikelihood_(Vision.likelihood.VERY_LIKELY, 'POSSIBLE');
* // false
*
* Vision.gteLikelihood_(Vision.likelihood.UNLIKELY, 'POSSIBLE');
* // true
*/
Vision.gteLikelihood_ = function(baseLikelihood, likelihood) {
return Vision.likelihood[likelihood] >= baseLikelihood;
};
/*! Developer Documentation

@@ -1646,0 +1660,0 @@ *

@@ -18,3 +18,3 @@ /*!

var visionClient = require('./image_annotator_client');
var visionApi = require('./image_annotator_api');
var extend = require('extend');

@@ -28,7 +28,7 @@ var gax = require('google-gax');

var gaxGrpc = gax.grpc(options);
return visionClient(gaxGrpc);
return visionApi(gaxGrpc);
}
v1.SERVICE_ADDRESS = visionClient.SERVICE_ADDRESS;
v1.ALL_SCOPES = visionClient.ALL_SCOPES;
v1.SERVICE_ADDRESS = visionApi.SERVICE_ADDRESS;
v1.ALL_SCOPES = visionApi.ALL_SCOPES;
module.exports = v1;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc