Amazon Textract Caller tools
Low maintenance activity. Last release over 2 years ago, commits in 3 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install amazon-textract-callerTextract-Caller
amazon-textract-caller provides a collection of ready to use functions and sample implementations to speed up the evaluation and development for any project using Amazon Textract.
Making it easy to call Amazon Textract regardless of file type and location.
Install
> python -m pip install amazon-textract-caller
Functions
from textractcaller import call_textract
def call_textract(input_document: Union[str, bytes],
features: Optional[List[Textract_Features]] = None,
queries_config: Optional[QueriesConfig] = None,
output_config: Optional[OutputConfig] = None,
adapters_config: Optional[AdaptersConfig] = None,
kms_key_id: str = "",
job_tag: str = "",
notification_channel: Optional[NotificationChannel] = None,
client_request_token: str = "",
return_job_id: bool = False,
force_async_api: bool = False,
call_mode: Textract_Call_Mode = Textract_Call_Mode.DEFAULT,
boto3_textract_client=None,
job_done_polling_interval=1) -> dict:
Also useful when receiving the JSON response from an asynchronous job (start_document_text_detection or start_document_analysis)
from textractcaller import get_full_json
def get_full_json(job_id: str = None,
textract_api: Textract_API = Textract_API.DETECT,
boto3_textract_client=None)->dict:
And when receiving the JSON from the OutputConfig location, this method is useful as well.
from textractcaller import get_full_json_from_output_config
def get_full_json_from_output_config(output_config: OutputConfig = None,
job_id: str = None,
s3_client = None)->dict:
Samples
Calling with file from local filesystem only with detect_text
textract_json = call_textract(input_document="/folder/local-filesystem-file.png")
Calling with file from local filesystem only detect_text and using in Textract Response Parser
(needs trp dependency through python -m pip install amazon-textract-response-parser)
import json
from trp import Document
from textractcaller import call_textract
textract_json = call_textract(input_document="/folder/local-filesystem-file.png")
d = Document(textract_json)