Reusable code for Google Document-AI services
Project description
Instructions
Installing
- Install using
pip
command
Use the pip command to install this package:
pip install reusable-code-for-document-ai
Basic Usage
NOTE: Our system will support only image file and pdf file.
from reusable_code.process_document import CustomGoogleDocAIProcessor
processor = GoogleDocAIProcessor(
location="your_location",
processor_name="your_processor_name",
processor_options=your_processor_options
)
document = processor.process_document("path_to_your_document", extract_page_number)
path_to_your_document
= your pdf or image file path.
extract_page_number
= Which page you want to extract, page number.
processor options
NOTE: Additional configurations for Document OCR Processor (Optional).
# For more information: https://cloud.google.com/document-ai/docs/enterprise-document-ocr
process_options = documentai.ProcessOptions(
ocr_config=documentai.OcrConfig(
enable_native_pdf_parsing=True,
enable_image_quality_scores=True,
enable_symbol=True,
# OCR Add Ons https://cloud.google.com/document-ai/docs/ocr-add-ons
premium_features=documentai.OcrConfig.PremiumFeatures(
compute_style_info=True,
enable_math_ocr=False, # Enable to use Math OCR Model
enable_selection_mark_detection=True,
),
)
)
Follow this pattern for set processor name
your_processor_name = projects/<PROJECT_ID>/locations/us/processors/<processor-id>/processorVersions/<version-id>
Make sure to replace your_location
, your_processor_name
, your_processor_options
, and path_to_your_document
with appropriate values.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for reusable-code-for-document-ai-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cd4315d1ee3d2956eafda0e82889198e4e0c6040501b408a28007ceb13e3b0d |
|
MD5 | 6b6087c80d808c50e04eea77584ed6db |
|
BLAKE2b-256 | 97a511ef678a42b949cff5fe503ce0507e2a623e90d9b06b084985b256774b41 |
Close
Hashes for reusable_code_for_document_ai-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42c411576b54dea92814d943145a392d152bf02c869e5e677c0620c6a4227695 |
|
MD5 | c12c33a44664024cece1b6aaeb0691b6 |
|
BLAKE2b-256 | 29b7c90c8b2486bdb96a314bae0d210dca664570f301da253c050eb3897a74c4 |