question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't seem to access Vision.types that we had in 0.12

See original GitHub issue

This is a followup from https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2516

I had this issue where we could not compare Likelyhoods and this was fixed using Types.

However in 0.13.0 I can’t seem to find the types anymore. I used to be able to do:

var Vision = require('@google-cloud/vision')
var visionClient = new Vision({...})

visionClient.annotateImage({...})
  .then(responses => {
    var response = responses[0]
    console.log(Vision.types.Likelihood[response.safeSearchAnnotation.adult]) // 1
  })

Are the types published in a different node modules?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stephenpluspluscommented, Dec 20, 2017

Confirmed; these were definitely lost when we transitioned to an auto-generated bottom layer. I’ll ask around to see if we lost these for a reason, or if we can find a way to get them back.

For now, here is a much less intuitive way to do this:

const vision = require('@google-cloud/vision')
const path = require('path')
const grpc = require('google-gax').grpc()

const likelihood = grpc.loadProto(
  path.join(require.resolve('@google-cloud/vision'), '..', '..', 'protos'),
  `google/cloud/vision/v1/image_annotator.proto`
).google.cloud.vision.v1.Likelihood.values;

likelihood == {
  UNKNOWN: 0,
  VERY_UNLIKELY: 1,
  UNLIKELY: 2,
  POSSIBLE: 3,
  LIKELY: 4,
  VERY_LIKELY: 5
}
0reactions
stephenpluspluscommented, Oct 7, 2019

Looks like https://github.com/googleapis/gapic-generator/issues/1756 was closed, which effectively closes this. Goodbye, #17.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a website that sells prescription glasses that aren't ...
-0.12 means you don't need glasses. That's a 12th (actually an 8th) of a diopter. It would even be hard to order glasses...
Read more >
Low Vision: Causes, Treatment, & Prevention - Cleveland Clinic
Low vision is vision loss that can't be corrected with glasses, contacts or surgery. It isn't blindness as limited sight remains.
Read more >
What Does Sphere Cylinder and Axis Mean? - RX Safety
The term sphere is used because the correction of either the farsightedness or nearsightedness is equal across all the meridians of your eye,...
Read more >
Restore `types` property with raw proto contents · Issue #1756 ...
This issue inspired by googleapis/nodejs-vision#17 As explained in the ... Can't seem to access Vision.types that we had in 0.12 googleapis/nodejs-vision#17.
Read more >
Visual Acuity - CVI Scotland
Normal (6/6 or 20/20) vision equates to 0.0LogMAR (see conversion table below). There are two types of visual acuity 1. Threshold visual acuity....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found