小编nik*_*gan的帖子

什么参数对于 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
查看次数