Web application problem with block view

Hi

I am trying to set-up an annotation recipe for question answering database.
The annotation UI crashes after I select some tokens int the paragraph. with "Oops, something went wrong :(".
I use Prodigy 1.9.10.

The web console shows this stack trace:

TypeError: "items is null"
    p http://question.tukekemt.xyz/bundle.js:1
    h http://question.tukekemt.xyz/bundle.js:1
    value http://question.tukekemt.xyz/bundle.js:1
    s http://question.tukekemt.xyz/bundle.js:1
    beginWork http://question.tukekemt.xyz/bundle.js:1
    r http://question.tukekemt.xyz/bundle.js:1
    i http://question.tukekemt.xyz/bundle.js:1
    a http://question.tukekemt.xyz/bundle.js:1
    k http://question.tukekemt.xyz/bundle.js:1
    x http://question.tukekemt.xyz/bundle.js:1
    batchedUpdates http://question.tukekemt.xyz/bundle.js:1
    lt http://question.tukekemt.xyz/bundle.js:1
    $t http://question.tukekemt.xyz/bundle.js:1
bundle.js:1:652962
    s http://question.tukekemt.xyz/bundle.js:1
    a http://question.tukekemt.xyz/bundle.js:1
    k http://question.tukekemt.xyz/bundle.js:1
    x http://question.tukekemt.xyz/bundle.js:1
    batchedUpdates http://question.tukekemt.xyz/bundle.js:1
    lt http://question.tukekemt.xyz/bundle.js:1
    $t http://question.tukekemt.xyz/bundle.js:1

I use this recipe:

import prodigy
from prodigy.components.loaders import JSONL
from prodigy.util import split_string
from collections import Counter
from typing import List, Optional
@prodigy.recipe(
    "question",
    dataset=("The dataset to use", "positional", None, str),
    source=("The source data as a JSONL file", "positional", None, str),
    exclude=("Names of datasets to exclude", "option", "e", split_string),
)
def question(dataset: str, source: str, exclude: Optional[List[str]] = None):
 
    stream = JSONL(source)
    return {
        "view_id": "blocks",  # Annotation interface to use
        "config": {
            "exclude_by": "input",
            "blocks": [
                {
                 "view_id": "ner_manual",
                 "labels": ["Vyznačte odpoveď"],
                },
                {
                 "view_id": "text_input",
                 "field_rows": 1,
                 "field_autofocus":True,
                 "field_label": "Čo Vás zaujíma?",
                 "field_placeholder": "Napíšte otázku...",
                 "text":None
                },
                {
                 "view_id":"classification",
                 "text":None
                },
            ]
        },
        "dataset": dataset,  # Name of dataset to save annotations
        "stream": stream,  # Incoming stream of examples
    }

One task has the following attributes:

  • field_id: task identification
  • label: heading for paragraph
  • text: paragraph to annotate
  • tokens: list of tokens (start, end, text)

Where is the error and is there some workaround?

Thanks

Daniel

Hi! I can't seem to reproduce this :thinking: If I run your recipe with some sample data, it look like this for me:

I'd say that this is the most likely explanation for something going wrong – maybe double-check that your "tokens" have the expected format and all include a text, start, end and id?

source.jsonl (12.0 KB)

Dear Ines

Thank you for a quick check. II can't see any error according to the documentation. I put file with two tasks into the attachment.

Would you be so kind to have a look?

The app crashes after I select some tokens.

Thanks

Thanks for sharing the data! I just ran it using my local dev version (which will be Prodigy v1.10) and it worked fine out-of-the-box:

I don't really remember changing anything that could have an impact, but I can set up a local env with v1.9.10 and test it as well. But in any case, the good news is, looks like there's no problem in the upcoming v1.10 (which should be released this week) :slightly_smiling_face:

Thanks. I will try it as soon as I get the download link.

Dear Ines

The web application crashes after I select some tokens (as for NER annotation).

But, I have resolved the problem by removing the ""classification" block. There seems to be some conflict of "classification" block with "text_input" or "ner_manual" blocks.

Ah, I think I might know what the problem is, then: if you use classification with "text": None, that's pretty unexpected, because the classification UI can still render text and spans, so it will try and render the spans you annotate on a None text. I think setting "spans": None may help, too – or, if you just want to render that one label anyways, you might as well use a regular text or HTML block, which is simpler and probably a better fit in general.