Providing an image from filesystem for ner.manual tasks

Hi, I need to display an image (from filesystem) along with each of NER tasks in the interface.

Through the docs and a little trial and error, I managed to land on this solution:

recipe.py

# After loading the model...
stream = JSONL(source)
stream = add_tokens(nlp, stream)

img_stream = ImageServer(r"path\to\images")

def mergeStreams(s1, s2):
    for r1, r2 in zip(s1, s2):
        yield {**r1, **r2}

combinedStream = mergeStreams(stream, img_stream)

return {
    "view_id": "blocks",  # Annotation interface to use
    "dataset": dataset,  # Name of dataset to save annotations
    "stream": combinedStream,  # Incoming stream of examples
    "exclude": exclude,  # List of dataset names to exclude
    "config": {  # Additional config settings, mostly for app UI
        "lang": nlp.lang,
        "labels": label,  # Selectable label options
        "blocks": [
            {"view_id":"html", "html_template": "<img src={{image}} />"},
            {"view_id":"ner_manual"},
        ],
    }
}

source.jsonl is of the format: {"text": "NER text here"}

I want to know if this is the correct way to implement this interface? Or is there a better solution that will let me specify image filenames for each task as well?

Yes, that looks good to me :+1: (You could also use "view_id": "image" instead of the HTML block here, but the result of that should be the same, so it doesn't really matter.)