πŸ“‹ OCR / Document Parsing

With Eden AI, you can access to many OCR technologies. For each of those technologies, different providers are available.

You can use all those technologies through the platform or API. Do not hesitate to check our Getting Started With Your API to use API.

Here is the complete list of all OCR technologies on Eden AI:

Subfeatures

  1. OCR Generic: Optical Character Recognition or optical character reader (OCR) is the electronic or mechanical conversion of images of typed, handwritten or printed text into machine-encoded text, whether from a scanned document, a photo of a document.
  2. Invoice Parser: The OCR Invoice Parser API enables users to take invoices in a variety of formats and return structured data to automate the invoice processing.
  3. Resume Parser: allows customers to analyze resumes and CVs and return structured representation of the candidate profile & experiences.
  4. Receipt Parser: allows customers to extract information from a receipt: products purchased, quantity, price, date, VAT amount, etc.
  5. OCR Table: allows customers to analyze documents containing tables and return structured representation of said tables in the form of a Json object.
  6. OCR ID/Passport: automatically extract information from a passport. It will return JSON with all of the associated data including name, date of birth, nationality and more.

Usage

All OCR subfeatures APIs work in a similar way except for OCR Table which is asynchronous.

To use them, we have to call a POST request to the API with the image/pdf file, the desired subfeature and the available providers. The API will then return a result.

For async jobs (like OCR Table), it will return a job ID then you can use the GET operation to get the completion status of the request with the job ID. Finally, when the process is over you can access the OCR Table request results by calling a GET operation again.

You can see all the OCR APIs endpoints by checking our official API Reference.

The information in the following examples uses Receipt Parser with both Base64 and Mindee to show how Eden AI Receipt Parser works.

Receipt Parser example

You can use OCR Receipt Parser request by calling a POST request. The following is an example that makes a call to the API with the image.png image file.

import requests

headers = {"Authorization": "Bearer πŸ”‘ Your_API_Key"}

url="https://api.edenai.run/v2/ocr/receipt_parser"
data={"providers": "base64,mindee", 'language':'en'}
files = {'file': open("πŸ–ΌοΈ path/to/your/image.png",'rb')}

response = requests.post(url, data=data, files=files, headers=headers)

result = response.json()
print(result['base64']['extracted_data'])

Here is what the result of Base64 looks like :

{
  "invoice_number": "07.00-21.00",
  "invoice_total": 168.95,
  "invoice_subtotal": null,
  "barcodes": [],
  "category": null,
  "date": "2022-04-02",
  "due_date": null,
  "time": "12:29:23",
  "customer_information": {
    "customer_name": null
  },
  "merchant_information": {
    "merchant_name": "SC AUCHAN ROMANIA SA",
    "merchant_address": null,
    "merchant_phone": null,
    "merchant_url": null,
    "merchant_siret": null,
    "merchant_siren": null
  },
  "payment_information": {
    "card_type": "Mastercard",
    "card_number": "168,95",
    "cash": null,
    "tip": null,
    "discount": null,
    "change": null
  },
  "locale": {
    "currency": null,
    "language": null,
    "country": null
  },
  "taxes": [
    {
      "taxes": 24.52,
      "rate": null
    }
  ],
  "receipt_infos": {
    "payment_code": null,
    "host": null,
    "payment_id": null,
    "card_type": "Mastercard",
    "receipt_number": "07.00-21.00"
  },
  "item_lines": [
    {
      "description": "GP SUPER ALKALINE LR",
      "quantity": 1,
      "amount": 1870,
      "unit_price": 1870
    },
    {
      "description": "NUTELLA 700G",
      "quantity": 1,
      "amount": 19.4,
      "unit_price": 19.4
    }
  ]
}

Standardization

All the fields that you can see in the previous response are standardized to facilitate their use when switching between providers. Indeed, for example, you will find in all providers responses receipt_infos or items_lines fields.

You can see in more detail the standardization proposed by Eden AI for Receipt Parser by following this link : Receipt Parser Dataclass

Pricing

Default pricing for OCR is per page, meaning that you pay a certain amount for each page that you want to process using OCR.

There are exceptions to this pricing model for certain providers, such as Hireability, Sentisight, and Affinda (only for resume parser). For these providers, you pay per file instead of per page.

Eden AI combine

Eden AI combines the most relevant fields returned by the called providers by comparing the confidence scores.
Currently, only OCR ID/Passport have Eden AI combined results.