Use crowd-textract-analyze-document with start_human_loop

0

I'm trying to use the crowd-textract-analyze-document widget on a custom task with sagemaker.

The problem is call the human loop from "start_human_loop" function not from analyze_document.

The human loop tasks is not rendered, the error can be reproduced using "render_ui_template" function

response = sagemaker_client.render_ui_template( UiTemplate={"Content": template_content}, Task={"Input": input_json}, RoleArn=role, )

I'm using the default template from the documentation. https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-crowd-textract-detection.html With the minimal ranges to read the data from task.input, so I assume than the error is on the input data.

The error raised is

crowd-html-elements-without-ce-polyfill.js:689 Uncaught TypeError: Cannot read properties of undefined (reading 'text')

The entire json used is this one that includes the "text" attribute, so I don't have any idea of why means the error:

{
  "TaskObject": "s3://foo_bar/foo_bar.pdf",
  "Keys": [
    {
      "importantFormKey": "Foo bar"
    }
  ],
  "Blocks": [
    {
      "blockType": "KEY_VALUE_SET",
      "confidence": 93.0,
      "geometry": {
        "boundingBox": {
          "width": 0.09730120003223419,
          "height": 0.009636270813643932,
          "left": 0.5012893676757812,
          "top": 0.3701384961605072
        },
        "polygon": [
          {
            "x": 0.5012893676757812,
            "y": 0.3701384961605072
          },
          {
            "x": 0.5985905528068542,
            "y": 0.3701384961605072
          },
          {
            "x": 0.5985905528068542,
            "y": 0.3797747790813446
          },
          {
            "x": 0.5012893676757812,
            "y": 0.3797747790813446
          }
        ]
      },
      "id": "6231be31-5f56-41db-95cf-2dad8f765cca",
      "relationships": [
        {
          "type": "VALUE",
          "ids": [
            "b7697bbd-c5f5-4d28-a345-92c1f53daef7"
          ]
        },
        {
          "type": "CHILD",
          "ids": [
            "57c87916-0636-4d51-8d3b-8d15f4e93d73",
            "f38b7a0f-2750-46e0-960f-8d6b58dcab3d"
          ]
        }
      ],
      "entityTypes": [
        "KEY"
      ],
      "text": "Foo bar",
      "page": 1
    },
    {
      "blockType": "KEY_VALUE_SET",
      "confidence": 93.0,
      "geometry": {
        "boundingBox": {
          "width": 0.2203546017408371,
          "height": 0.019548991695046425,
          "left": 0.6025875210762024,
          "top": 0.3636907935142517
        },
        "polygon": [
          {
            "x": 0.6025875210762024,
            "y": 0.3636907935142517
          },
          {
            "x": 0.8229421377182007,
            "y": 0.3636907935142517
          },
          {
            "x": 0.8229421377182007,
            "y": 0.3832397758960724
          },
          {
            "x": 0.6025875210762024,
            "y": 0.3832397758960724
          }
        ]
      },
      "id": "b7697bbd-c5f5-4d28-a345-92c1f53daef7",
      "relationships": [
        {
          "type": "CHILD",
          "ids": [
            "d803e2ba-c238-4af1-8745-0dbb17e74420"
          ]
        }
      ],
      "entityTypes": [
        "VALUE"
      ],
      "text": "Foo bar",
      "page": 1
    }
  ]
}
gefragt vor 2 Jahren101 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen