클라이언트 라이브러리를 사용하여 문서 처리
이 페이지에서는 선호하는 프로그래밍 언어로 Document AI API를 시작하는 방법을 보여줍니다.
시작하기 전에
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Document AI API.
-
Create a service account:
-
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart
. - Click Create and continue.
-
Grant the Project > Owner role to the service account.
To grant the role, find the Select a role list, then select Project > Owner.
- Click Continue.
-
Click Done to finish creating the service account.
Do not close your browser window. You will use it in the next step.
-
-
Create a service account key:
- In the Google Cloud console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, and then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Click Close.
-
Set the environment variable
GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again. -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Document AI API.
-
Create a service account:
-
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart
. - Click Create and continue.
-
Grant the Project > Owner role to the service account.
To grant the role, find the Select a role list, then select Project > Owner.
- Click Continue.
-
Click Done to finish creating the service account.
Do not close your browser window. You will use it in the next step.
-
-
Create a service account key:
- In the Google Cloud console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, and then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Click Close.
-
Set the environment variable
GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again.
클라이언트 라이브러리 설치
C#
C# 개발 환경 설정에 관한 자세한 내용은 C# 개발 환경 설정 가이드를 참조하세요.
Install-Package Google.Cloud.DocumentAI.V1 -Pre
Go
go get cloud.google.com/go/documentai
Java
자바 개발 환경 설정에 관한 자세한 내용은 자바 개발 환경 설정 가이드를 참조하세요.
If you are using Maven, add
the following to your pom.xml
file. For more information about
BOMs, see The Google Cloud Platform Libraries BOM.
If you are using Gradle, add the following to your dependencies:
If you are using sbt, add the following to your dependencies:
If you're using Visual Studio Code, IntelliJ, or Eclipse, you can add client libraries to your project using the following IDE plugins:
The plugins provide additional functionality, such as key management for service accounts. Refer to each plugin's documentation for details.
Node.js
Node.js 개발 환경 설정에 관한 자세한 내용은 Node.js 개발 환경 설정 가이드를 참조하세요.
npm install @google-cloud/documentai
PHP
composer require google/cloud-document-ai
Python
Python 개발 환경 설정에 관한 자세한 내용은 Python 개발 환경 설정 가이드를 참조하세요.
pip install --upgrade google-cloud-documentai
Ruby
Ruby 개발 환경 설정에 관한 자세한 내용은 Ruby 개발 환경 설정 가이드를 참조하세요.
gem install google-cloud-document_ai
문서 처리
Document AI API를 사용하여 로컬 PDF 문서에서 정보를 요청합니다. 다음 샘플을 실행하려면 먼저 UI에서 프로세서를 만들어야 합니다.
콘솔
Google Cloud 콘솔의 Document AI 섹션에서 Processors 페이지로 이동합니다.
프로세서 만들기를 선택합니다.
만들려는 목록에서 프로세서 유형을 클릭합니다.
측면 프로세서 만들기 창에서 프로세서 이름을 지정합니다.
목록에서 리전을 선택합니다.
만들기를 클릭하여 프로세서를 생성합니다.
프로세서를 만들고 프로세서 ID를 가져온 후 다음 코드를 실행하여 개별 문서 처리를 요청합니다.
C#
자세한 내용은 Document AI C# API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
C++
자세한 내용은 Document AI C++ API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Go
자세한 내용은 Document AI Go API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Java
자세한 내용은 Document AI Java API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Node.js
자세한 내용은 Document AI Node.js API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
PHP
자세한 내용은 Document AI PHP API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Python
자세한 내용은 Document AI Python API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Ruby
자세한 내용은 Document AI Ruby API 참조 문서를 참고하세요.
Document AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
어땠나요?
삭제
이 빠른 시작에서 사용한 리소스 비용이 Google 계정에 청구되지 않도록 하려면 다음 단계를 따르세요.
- Google Cloud 콘솔에서 필요하지 않은 프로젝트를 삭제합니다.
다음 단계
Document AI API 클라이언트 라이브러리에 대해 자세히 알아보세요.