【发布时间】:2020-04-07 17:41:27
【问题描述】:
我正在运行来自 cloud-vision API 示例存储库的以下代码。我已按照此处的说明进行操作:https://cloud.google.com/vision/docs/quickstart-client-libraries?refresh=1 设置服务帐户和身份验证,但我仍然无法成功执行此功能。
async function detectLabels() {
// [START vision_label_detection]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ImageAnnotatorClient();
const fileName = './src/img/wakeupcat.jpg';
// Performs label detection on the local file
const [result] = await client.labelDetection(fileName);
const labels = result.labelAnnotations;
console.log('Labels:');
labels.forEach(label => console.log(label.description));
// [END vision_label_detection]
}
detectLabels();
这会产生以下错误:
错误:8 RESOURCE_EXHAUSTED:配额指标“请求”超出配额,并限制消费者“project_number:6579173653”的服务“vision.googleapis.com”的“每分钟请求数”。
我使用的 wakupcat.jpg 图像为 14kb,所以不是大小问题。
【问题讨论】:
标签: google-cloud-platform google-api google-cloud-vision google-cloud-sdk