Request Human Review of a Document
After you have set up your Google Cloud account, created a processor, and enabled human review, you can send a review request to your processor. This page provides details for how to request ad-hoc Human Review of a document.
Request Human Review
Web UI
Open the Human-in-the-Loop page in the Google Cloud console.
Click on the processor you want to use for human review.
Select Upload Document and upload a local file to be sent for review. Allow 1-2 minutes for the document to appear in the review queue.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: Your Google Cloud project ID.
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROCESSOR_ID: the ID of your custom processor.
- ENABLE_SCHEMA_VALIDATION: Whether schema validation should be performed on the ad-hoc review request.
true
- Enables schema validation on the ad-hoc review request.false
- Disables schema validation on the ad-hoc review request.
- PRIORITY: The priority of the human review task.
DEFAULT
- The default priority level.URGENT
- The urgent priority level. The labeling manager should allocate labeler resource to the urgent task queue to respect this priority level.
- DOCUMENT: A
Document
object that has already been processed by the processor configured for review.
HTTP method and URL:
POST https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/humanReviewConfig:reviewDocument
Request JSON body:
{ "enableSchemaValidation": ENABLE_SCHEMA_VALIDATION, "priority": "PRIORITY", "inlineDocument": "DOCUMENT" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/humanReviewConfig:reviewDocument"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/humanReviewConfig:reviewDocument" | Select-Object -Expand Content
If the request is successful, the response contains an instance of
Operation
.
You can read more about Long-Running Operations in the documentation.
{ "name": "projects/PROJECT_ID/locations/LOCATION/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata", "commonMetadata": { "state": "RUNNING", "createTime": "TIMESTAMP", "updateTime": "TIMESTAMP", "resource": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/humanReviewConfig" } } }
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.