Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/math/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform ImageAnnotatorClient谷歌视觉API_Google Cloud Platform_Vision Api - Fatal编程技术网

Google cloud platform ImageAnnotatorClient谷歌视觉API

Google cloud platform ImageAnnotatorClient谷歌视觉API,google-cloud-platform,vision-api,Google Cloud Platform,Vision Api,正在尝试使用节点通过vision api运行标签检测: 'use strict'; // Imports the Google Cloud client library const vision = require('@google-cloud/vision'); // Creates a client const client = new ImageAnnotatorClient({ projectId: 'my-project-xxx', keyFilename: 'Users/xxx/

正在尝试使用节点通过vision api运行标签检测:

'use strict';
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');

// Creates a client
const client = new ImageAnnotatorClient({
projectId: 'my-project-xxx',
 keyFilename: 'Users/xxx/Downloads/xxx.json',
});

// Performs label detection on the image file
client
 .labelDetection('.//Users/xxx/Downloads/menu.jpg')
 .then(results => {
   const labels = results[0].labelAnnotations;

console.log('Labels:');
labels.forEach(label => console.log(label.description));
})
.catch(err => {
  console.error('ERROR:', err);
 });
持续接收错误:“未定义ImageAnnotatorClient”
有什么原因吗?

能否尝试修改行:

const client = new ImageAnnotatorClient({
用于:


ImageAnnotatorClient方法是从Cloud Vision API中提取的,您将其作为
Vision
变量导入。

是否可以尝试修改该行:

const client = new ImageAnnotatorClient({
用于:


ImageAnnotatorClient方法是从Cloud Vision API中提取的,您将其作为
Vision
变量导入。

我尝试了此操作,但返回了此错误:“TypeError:Vision.ImageAnnotatorClient不是构造函数”您正在运行哪个版本的库?(
npm ls@google cloud/vision
)将软件包升级到最新版本(0.14.0):
npm安装--save@google cloud/vision
我尝试了这个方法,但返回了这个错误:“TypeError:vision.ImageAnnotatorClient不是构造函数”您正在运行哪个版本的库?(
npm-ls@google-cloud/vision
)将软件包升级至最新版本(0.14.0):
npm-install-save@google-cloud/vision