- Supervised Form Recognizer
This code is provided for demo purposes only for course AI-102.
- Azure Subscription
- Python
-
Create a storage account and upload files from the invoice folder to the new container. Create a SAS for the created container.
-
Create Form Recognizer resource and retrieve key and endpoint values
-
Login in Form Recognizer sample labeling tool
-
Click on
connected settings
and create connection to storage account with SAS token generated before. Details provided in the tutorial -
Create a new custom project to train models with labels. Provide key and endpoint you copied early
-
Click on 'Tags editor' and from apply labels to the text the details in tutorial
- You need to have 5 documents labeled to train the model. Complete training for model as explained in tutorial
- Finally analyze trained form by uploading test document test_invoice.pdf as explained in tutorial
Note that the recognizer can parse and retrieve labels from table's rows with specific name. eg. backup cost.
-
From the labeling tool copy Model ID from model completed above. The Model ID is located on
Train
page. -
From Azure portal copy
endpoint
andkey
for Form Recognizer created above. -
Update Python script with copied values as following:
# Endpoint URL
endpoint = ""
# Subscription Key
apim_key = ""
# Model ID
model_id = ""
- Run the script by following command from terminal:
py .\analyze-81e0.py .\test_invoice.pdf -o result.json
- Observe generated field
results.json
Each filed asPO Number
andAddress
should present on the top of the document with parsed values.