This quickstart introduces you to Document AI. In this quickstart, you will use the Google Cloud Console to set up your Google Cloud project and authorization, create a form parser, and then make a request for Document AI to process a form PDF document.
Before you begin
-
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
-
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 Cloud project. Learn how to confirm that billing is enabled for your project.
- Enable the Cloud Document AI API.
-
Set up authentication:
-
In the Cloud Console, go to the Create service account key page.
Go to the Create Service Account Key page - From the Service account list, select New service account.
- In the Service account name field, enter a name.
From the Role list, select Project > Owner.
- Click Create. A JSON file that contains your key downloads to your computer.
-
-
Set the environment variable
GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your service account key. This variable only applies to your current shell session, so if you open a new session, set the variable again. - Install and initialize the Cloud SDK.
Create a form parser
Use the Google Cloud Console to create a new form parser:
Open the Document AI dashboard.
Click Create processor.
In the Create processor page, select the Form parser option.
In the side window, name your processor
quickstart-form-processor
and choose your region.Click Create. You will be taken to the details page of your newly created form processor.
Send the request to the form parser
After creating your processor you can send annotation requests to it.
Save a local copy of the sample form document (
gs://cloud-samples-data/documentai/loan_form.pdf
). This document is stored in a publicly accessible Cloud Storage bucket.In the Test your processor section of the processor detail page, upload the local version of the sample form. This takes you to the document analysis page where you can view the document annotations returned.
Clean up
To avoid unnecessary Google Cloud charges, use the Cloud Console to delete your processor and project if you do not need them.
What's next
- Read an overview of Document AI features in the Basics topic.
- See a list and descriptions of currently available processors.
- Learn how to set specific region data storage and document processing.