我正在尝试使用 npm 模块 watson-developer-cloud 进行视觉识别。我{ error: 'invalid-api-key', code: 401 }
在尝试运行以下代码时得到:
var watson = require('watson-developer-cloud');
var fs = require('fs');
var visualRecognition = watson.visual_recognition({
version: 'v3',
api_key: process.env.API_KEY || 'e2493f2bacdbea8becedcc7aafecdfb4133XXXXX',
version_date: '2015-05-19'
});
var params = {
images_file: fs.createReadStream('./resources/gopher.png')
};
visualRecognition.classify(params, function(err, res) {
if (err)
console.log(err);
else
console.log(JSON.stringify(res, null, 2));
});