Skip to content

Commit

Permalink
update readme for preview.3 (#17649)
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinaperalta authored Mar 30, 2021
1 parent 41db0ef commit d678b06
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions sdk/formrecognizer/azure-ai-formrecognizer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from form documents. It includes the following main functionalities:
* Receipt model - Recognize data from sales receipts using a prebuilt model.
* Business card model - Recognize data from business cards using a prebuilt model.
* Invoice model - Recognize data from invoices using a prebuilt model.
* Id document model - Recognize data from id documents using a prebuilt model.

[Source code][python-fr-src] | [Package (PyPI)][python-fr-pypi] | [API reference documentation][python-fr-ref-docs]| [Product documentation][python-fr-product-docs] | [Samples][python-fr-samples]

Expand All @@ -26,14 +27,14 @@ Install the Azure Form Recognizer client library for Python with [pip][pip]:
pip install azure-ai-formrecognizer --pre
```

> Note: This version of the client library defaults to the v2.1-preview.2 version of the service
> Note: This version of the client library defaults to the v2.1-preview.3 version of the service
This table shows the relationship between SDK versions and supported API versions of the service

|SDK version|Supported API version of service
|-|-
|3.0.0 - Latest GA release (can be installed by removing the `--pre` flag)| 2.0
|3.1.0b3 - Latest release (beta)| 2.0, 2.1-preview.2
|3.1.0b4 - Latest release (beta)| 2.0, 2.1-preview.3


#### Create a Form Recognizer resource
Expand Down Expand Up @@ -138,6 +139,7 @@ form_recognizer_client = FormRecognizerClient(
- Sales receipts. See fields found on a receipt [here][service_recognize_receipt].
- Business cards. See fields found on a business card [here][service_recognize_business_cards].
- Invoices. See fields found on an invoice [here][service_recognize_invoice].
- Id documents. See fields found on an id document [here][service_recognize_id_documents].
- Recognizing form content, including tables, lines, words, and selection marks, without the need to train a model. Form content is returned in a collection of `FormPage` objects.

Sample code snippets are provided to illustrate using a FormRecognizerClient [here](#recognize-forms-using-a-custom-model "Recognize Forms Using a Custom Model").
Expand Down Expand Up @@ -175,6 +177,7 @@ The following section provides several code snippets covering some of the most c
* [Recognize Receipts](#recognize-receipts "Recognize receipts")
* [Recognize Business Cards](#recognize-business-cards "Recognize business cards")
* [Recognize Invoices](#recognize-invoices "Recognize invoices")
* [Recognize Id Documents](#recognize-id-documents "Recognize id documents")
* [Train a Model](#train-a-model "Train a model")
* [Manage Your Models](#manage-your-models "Manage Your Models")

Expand Down Expand Up @@ -340,6 +343,28 @@ for invoice in result:
print("{}: {} has confidence {}".format(name, field.value, field.confidence))
```

### Recognize Id documents
Recognize data from id documents using a prebuilt model. Id document fields recognized by the service can be found [here][service_recognize_id_documents].

```python
from azure.ai.formrecognizer import FormRecognizerClient
from azure.core.credentials import AzureKeyCredential

endpoint = "https://<region>.api.cognitive.microsoft.com/"
credential = AzureKeyCredential("<api_key>")

form_recognizer_client = FormRecognizerClient(endpoint, credential)

with open("<path to your id document>", "rb") as fd:
id_document = fd.read()

poller = form_recognizer_client.begin_recognize_id_documents(id_document)
result = poller.result()

for id_document in result:
for name, field in id_document.fields.items():
print("{}: {} has confidence {}".format(name, field.value, field.confidence))
```

### Train a model
Train a custom model on your own form type. The resulting model can be used to recognize values from the types of forms it was trained on.
Expand Down Expand Up @@ -472,6 +497,7 @@ These code samples show common scenario operations with the Azure Form Recognize
* Recognize receipts from a URL: [sample_recognize_receipts_from_url.py][sample_recognize_receipts_from_url]
* Recognize business cards: [sample_recognize_business_cards.py][sample_recognize_business_cards]
* Recognize invoices: [sample_recognize_invoices.py][sample_recognize_invoices]
* Recognize id documents: [sample_recognize_id_documents.py][sample_recognize_id_documents]
* Recognize content: [sample_recognize_content.py][sample_recognize_content]
* Recognize custom forms: [sample_recognize_custom_forms.py][sample_recognize_custom_forms]
* Train a model without labels: [sample_train_model_without_labels.py][sample_train_model_without_labels]
Expand All @@ -490,6 +516,7 @@ are found under the `azure.ai.formrecognizer.aio` namespace.
* Recognize receipts from a URL: [sample_recognize_receipts_from_url_async.py][sample_recognize_receipts_from_url_async]
* Recognize business cards: [sample_recognize_business_cards_async.py][sample_recognize_business_cards_async]
* Recognize invoices: [sample_recognize_invoices_async.py][sample_recognize_invoices_async]
* Recognize id documents: [sample_recognize_id_documents_async.py][sample_recognize_id_documents_async]
* Recognize content: [sample_recognize_content_async.py][sample_recognize_content_async]
* Recognize custom forms: [sample_recognize_custom_forms_async.py][sample_recognize_custom_forms_async]
* Train a model without labels: [sample_train_model_without_labels_async.py][sample_train_model_without_labels_async]
Expand Down Expand Up @@ -545,6 +572,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[service_recognize_receipt]: https://aka.ms/formrecognizer/receiptfields
[service_recognize_business_cards]: https://aka.ms/formrecognizer/businesscardfields
[service_recognize_invoice]: https://aka.ms/formrecognizer/invoicefields
[service_recognize_id_documents]: https://aka.ms/formrecognizer/iddocumentfields
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging

[cla]: https://cla.microsoft.com
Expand All @@ -568,6 +596,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[sample_recognize_business_cards_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_business_cards_async.py
[sample_recognize_invoices]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_invoices.py
[sample_recognize_invoices_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_invoices_async.py
[sample_recognize_id_documents]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_id_documents.py
[sample_recognize_id_documents_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_id_documents_async.py
[sample_train_model_with_labels]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py
[sample_train_model_with_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py
[sample_train_model_without_labels]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py
Expand Down

0 comments on commit d678b06

Please sign in to comment.