小编Vai*_*ngh的帖子

Google Cloud Vision API'请求拒绝被拒绝'

我是Google Cloud Vision API的新手.我正在对图像进行OCR,主要用于账单和收据.

对于一些图像,它工作正常,但当我尝试其他一些图像时,它给了我这个错误:

Error:  { [Error: Request Admission Denied.]
  code: 400,
  errors:
   [ { message: 'Request Admission Denied.',
       domain: 'global',
       reason: 'badRequest' } ] }
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

// construct parameters
const req = new vision.Request({
image: new vision.Image('./uploads/reciept.png'),
features: [
new vision.Feature('TEXT_DETECTION', 1)
]
})

vision.annotate(req).then((res) => {
// handling response
//console.log(res.responses[0].textAnnotations);
var desc=res.responses[0].textAnnotations;
var descarr=[];
for (i = 0; i < desc.length; i++) { 
descarr.push(desc[i].description);
}
Run Code Online (Sandbox Code Playgroud)

ocr gcloud google-vision google-cloud-vision

5
推荐指数
1
解决办法
1473
查看次数

标签 统计

gcloud ×1

google-cloud-vision ×1

google-vision ×1

ocr ×1