Hi,
Thanks a lot for your input. I m trying to use the input jsonl file with the below content along to test with the following test recipe.
test_sample.json
}
{
"text": "Hello world",
"options": [
{"id": 0, "image": "/home/vandana_p/Selfies_Hair/0147F0201.jpg"},
{"id": 1, "image": "/home/vandana_p/Selfies_Hair/0147F0202.jpg"},
{"id": 2, "image": "/home/vandana_p/Selfies_Hair/0147F0203.jpg"}
]
}
{
"text": "Hello world",
"options": [
{"id": 0, "image": "/home/vandana_p/Selfies_Hair/0147F0207.jpg"},
{"id": 1, "image": "/home/vandana_p/Selfies_Hair/0147F0208.jpg"},
{"id": 2, "image": "/home/vandana_p/Selfies_Hair/0147F0209.jpg"}
]
}
test_recipe.py
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
#stream = add_options(stream) # add options to each task
return {
'dataset': dataset, # save annotations in this dataset
'view_id': 'choice', # use the choice interface
'stream': stream,
}
I am getting the following error.
<generator object add_options at 0x7f1a4e943fc0>
? Starting the web server at http://0.0.0.0:8080 ...
Open the app in your browser and start annotating!
Exception when serving /get_session_questions
Traceback (most recent call last):
File "cython_src/prodigy/components/loaders.pyx", line 145, in prodigy.components.loaders.JSONL
File "/home/vandana_p/hair_diagnostics/my_hair_selfie/lib/python3.6/site-packages/srsly/_json_api.py", line 37, in json_loads
return ujson.loads(data)
ValueError: Expected object or value
During handling of the above exception, another exception occurred:
......
......
File "/home/vandana_p/hair_diagnostics/my_hair_selfie/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
return next(iter(seq))
File "recipe.py", line 24, in add_options
for task in stream:
File "cython_src/prodigy/components/loaders.pyx", line 152, in JSONL
ValueError: Failed to load task (invalid JSON).
--------------------------------------------------------------------
It is failing to load the jsonl input file to stream. Is there anything I am missing? I could test the example feedback recipe in the prodigy site but not my test case.
Looking forward to your suggestions on how to fix this.
Regards,
Vandana