Skip to content

Using Textract Adapter with StartDocumentAnalysis

0

Hi,

I have created/trained an Adapter using the Console/wizard but am running into issues calling it from code/lambda in Python (3.12)

  1. Do I have to specify the same Queries used in the Adapter while calling textract.start_document_analysis() and use the FeatureTypes=["Queries"]/QueriesConfig etc.. This seems redundant and the AWS documentation is not clear on that
  2. If we have to pass in same, then everytime the model is updated/new question asked, then the lambda will need to be updated. Correct?
  3. How is the Adapter response returned? Same as Queries json/structure?

I found following, but this duplicates the questions, which IMO is not a good design

https://aws.amazon.com/blogs/machine-learning/customize-amazon-textract-with-business-specific-documents-using-custom-queries/

Thanks

asked 2 years ago513 views
1 Answer
0

Thank for using Amazon Textract. See below information that explains your queries:

  1. Yes, you have to specify the same Queries to used in the Adapter while calling textract.start_document_analysis() and use the FeatureTypes=["Queries"]/QueriesConfig inside code/lambda in Python (3.12). For example, below link[+] explains how to detect text using AWS Lambda function and AWS Textract. Inside the step3 : Add to python code, you can find the query(textract_client.detect_document_text(Document=image)) is added to the lambda function. [+]https://docs.aws.amazon.com/textract/latest/dg/lambda.html

  2. Correct, lambda will need to update everytime when the model is updated, otherwise you will face the same error from the code/lambda.

  3. The response is returned in the JSON format by the service. For more details you can refer to the AWS documentation - https://docs.aws.amazon.com/textract/latest/dg/API_StartDocumentAnalysis.html#API_StartDocumentAnalysis_ResponseElements

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.