HumanSignal / label-studio

Label Studio is a multi-type data labeling and annotation tool with standardized output format
https://labelstud.io
Apache License 2.0
17.31k stars 2.14k forks source link

import new tasks after add label some tasks #5478

Open Mahdi-Ba opened 4 months ago

Mahdi-Ba commented 4 months ago

Hi,I'm importing task like API docs and work.

curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
-X POST 'https://localhost:8080/api/projects/1/import' --data '[{"text": "Some text 1"}, {"text": "Some text 2"}]

but when I add label to a task and import new data like below give me error

curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
-X POST 'https://localhost:8080/api/projects/1/import' --data '[{"text": "Some text 3"}, {"text": "Some text 4"}]
{
    "id": "971aa980-b4e8-4ad4-bb54-75d69b5ba55d",
    "status_code": 400,
    "version": "1.11.0",
    "detail": "Validation error",
    "exc_info": null,
    "validation_errors": {
        "non_field_errors": [
            "Error at item 0: \"item\" key is expected in task data [assume: item as is = task root with values]  :: {'text': 'Some text 3'}"
        ]
    }
} 
shisaru292 commented 6 days ago

What's your labeling interface code in settings?

as api document said: https://api.labelstud.io/api-reference/api-reference/projects/import-tasks

Imported data is verified against a project label_config and must include all variables that were used in the label_config.

For example, if the label configuration has a $text variable, then each item in a data object must include a text field.