Library to support Nanonets service for intelligent document processing (IDP).

Added with rpaframework version 19.0.0.

Service supports identifying fields in the documents, which can be given to the service in multiple different file formats and via URL.

Robot Framework example usage

*** Settings ***
Library   RPA.DocumentAI.Nanonets
Library   RPA.Robocorp.Vault

*** Tasks ***
Identify document
    ${secrets}=   Get Secret  nanonets-auth
    Set Authorization    ${secrets}[apikey]
    ${result}=    Predict File
    ...  ${CURDIR}${/}files${/}eckero.jpg
    ...  ${secrets}[receipts-model-id]
    ${fields}=    Get Fields From Prediction Result    ${result}
    FOR    ${field}    IN    @{fields}
        Log To Console    Label:${field}[label] Text:${field}[ocr_text]
    ${tables}=    Get Tables From Prediction Result    ${result}
    FOR    ${table}    IN    @{tables}
        FOR    ${rows}    IN    ${table}[rows]
            FOR    ${row}    IN    @{rows}
                ${cells}=    Evaluate    [cell['text'] for cell in $row]
                Log To Console    ROW:${{" | ".join($cells)}}

Python example usage

from RPA.DocumentAI.Nanonets import Nanonets
from RPA.Robocorp.Vault import Vault

secrets = Vault().get_secret("nanonets-auth")
nanolib = Nanonets()
result = nanolib.predict_file(file_to_scan, secrets["receipts-model-id"])
fields = nanolib.get_fields_from_prediction_result(result)
for field in fields:
    print(f"Label: {field['label']} Text: {field['ocr_text']}")
tables = nanolib.get_tables_from_prediction_result(result)
for table in tables:
    rpatable = Tables().create_table(table["rows"])
    for row in table["rows"]:
        cells = [cell["text"] for cell in row]
        print(f"ROW: {' | '.join(cells)}")