activating html_template

Super new with Prodigy, but trying to setup html templates.

My prodigy.json is pretty straightforward:

{
    "theme": "basic",
    "port": 8080,
    "cors": true,
    "host": "0.0.0.0",
    "batch_size": 10,
    "html_template": "<strong>Template! {{text}}</strong>"
}

Then, starting prodigy:
prodigy ner.teach my_dataset en_core_web_sm dataset.jsonl

However I’m then greeted with the default UI.

Changing other settings in the prodigy.json has the intended effect (eg, theme), so I’m certain the config’s being read.

Is there another option I"m missing?

Hi! The problem here is that the html_template currently only works with the html interface. Otherwise, it’d also be very difficult for Prodigy to know how to interpret your template – especially since some of the other annotation interfaces (like the manual NER one) are pretty complex.

So you can either write your own custom recipe, or simply use the mark recipe, which streams in your data and renders it using an interface of your choice. The following command should show your template as expected:

prodigy mark my_dataset my_data.jsonl --view-id html

Ah I think I understand. Does this mean it’s not possible to utilize the highlighting annotation UI with custom templates?

ETA: my objective is to modify the named entity interface to display additional information alongside the piece of text to be annotated. is this possible via html_template config?

In general, the built-in interfaces are designed to focus on the main annotation decision, which is why the space for additional content is kept to a minimum. But if the information to display is short and/or a link, you can use the annotation task’s "meta" property. Meta entries will be displayed in the bottom right corner of the annotation card, and URLs will be linked automatically. For example:

{
    "text": "Some text",
    "meta": {
        "note": "This is a note",
        "url": "https://example.com"
    }
}

Do you mean the manual NER interface that lets you highlight spans by clicking and dragging? In Prodigy v1.5.0, this interface got a special setting for rendering additional text that’s not part of the highlightable annotation task. It’s mostly intended for formatting characters (bullet points, line breaks) that only help the annotator visually – but depending on what you want to do, you could repurpose that feature.

The manual NER recipe pre-tokenizes the text to allow token-based selection that “snaps” to the word boundaries. You can now mark individual tokens as "disabled": true and they’ll be displayed in grey and won’t be selectable:

{
    "text": "Hello Apple",
    "tokens": [
        {"text": "Hello", "start": 0, "end": 5, "id": 0, "disabled": true},
        {"text": "Apple", "start": 6, "end": 11, "id": 1}
    ],
    "spans": [
        {"start": 6, "end": 11, "label": "ORG", "token_start": 1, "token_end": 1}
    ]
}

thanks @ines, super responsive & helpful.

The extra text I’m looking to render is probably too substantial for the manual NER customization it sounds, so I’ll have to devise sthng else.

For reference the use case here is showing contextual information alongside the the relevant annotation task data.