相关疑难解决方法(0)

什么参数对于 Node.js 的 Google Document AI 客户端库无效?

我正在尝试使用 Node.js 应用程序运行 Google 的文档 OCR。所以我使用了 Node JavaScript 的客户端库@google-cloud/documentai

我做了像文档示例中那样的一切

有我的代码

const projectId = '*******';
const location = 'eu'; // Format is 'us' or 'eu'
const processor = '******'; // Create processor in Cloud Console
const keyFilename = './secret/******.json';

const { DocumentProcessorServiceClient } = require('@google-cloud/documentai').v1beta3;

const client = new DocumentProcessorServiceClient({projectId, keyFilename});

async function start(encodedImage) {

  console.log("Google AI Started")
  const name = `projects/${projectId}/locations/${location}/processors/${processor}`;

  const request = {
    name,
    document: {
      content: encodedImage,
      mimeType: 'application/pdf',
    },
  }

  try {
    const …
Run Code Online (Sandbox Code Playgroud)

node.js google-cloud-platform google-ai-platform cloud-document-ai

3
推荐指数
1
解决办法
2121
查看次数

文档 AI:google.api_core.exceptions.InvalidArgument:400 请求包含无效参数

尝试在 python 中从谷歌云实现文档 OCR 时出现此错误,如下所述:https : //cloud.google.com/document-ai/docs/ocr

当我跑

   result = client.process_document(request=request)
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

Traceback (most recent call last):
  File "/Users/Niolo/Desktop/untitled/Desktop/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 73, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/Niolo/Desktop/untitled/Desktop/lib/python3.8/site-packages/grpc/_channel.py", line 923, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/Niolo/Desktop/untitled/Desktop/lib/python3.8/site-packages/grpc/_channel.py", line 826, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.INVALID_ARGUMENT
    details = "Request contains an invalid argument."
    debug_error_string = "{"created":"@1614769280.332675000","description":"Error received from peer ipv4:142.250.180.138:443","file":"src/core/lib/surface/call.cc","file_line":1068,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
>
The above exception was the …
Run Code Online (Sandbox Code Playgroud)

python google-cloud-platform cloud-document-ai

2
推荐指数
1
解决办法
894
查看次数