I need to upload multimodal data with text alongside image but unable to upload the image from local path as it shows, can't find file.
My code is :
`import prodigy
from prodigy.components.loaders import JSONL
@prodigy.recipe('sentiment',
dataset=prodigy.recipe_args['dataset'],
file_path=("Path to texts", "positional", None, str))
def sentiment(dataset, file_path):
"""Annotate the sentiment of texts using different mood options."""
stream = JSONL(file_path) # load in the JSONL file
def update(examples):
# this function is triggered when Prodigy receives annotations
print("Received {} annotations!".format(len(examples)))
return {
'dataset': dataset, # save annotations in this dataset
'view_id': 'html', # use the choice interface
'stream': stream,
'update': update,
'config' : {"html_template": "<img src='{{image}}' /><h2>{{title}}</h2><strong>{{data.label}}</strong><span style='background: #ffe184'>{{data.value}}</span>"}
}`
Hi! The problem here is that you're only providing a relative path to the image (relative to your Python script). Even if you used the absolute path of the image on your machine, modern browser typically block local file paths for images etc. for security reasons.
See my post here for more details on how to solve this: