gpt4 book ai didi

javascript - NodeJS 谷歌云/视觉 : methods does not perform anything

转载 作者:行者123 更新时间:2023-11-30 06:55:04 25 4
gpt4 key购买 nike

我正在尝试在 NodeJS 应用中使用 Google Cloud Vision。关注client library example :

console.log('started')
// Performs label detection on the image file
client
.labelDetection('./mydocument.jpg')
.then(results => {
console.log('checked')
const labels = results[0].labelAnnotations

console.log('Labels:')
labels.forEach(label => console.log(label.description))
}, err => {
console.error('ERROR:', err)
})
.catch(err => {
console.error('ERROR:', err)
})

控制台中仅打印“已启动”。它不会进入成功或失败功能。查看 Google 的仪表板,它显示正在使用的 API(有一个实时图表会在我的 nodejs 应用程序运行时更新)。端点似乎没有返回任何内容,也没有超时。但我在文档、Stack Overflow 或 GitHub 问题中找不到任何内容。有什么线索吗?

最佳答案

尝试使用版本 0.22.1 复制您的场景,但一切顺利:

  1. 使用 npm install --save @google-cloud/vision 安装客户端库
  2. 使用了 quickstart 中提供的代码使用 console.log('started') 行。
  3. 结果如下:

Vision API Quickstart with Node JS

关于javascript - NodeJS 谷歌云/视觉 : methods does not perform anything,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51563897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com