HumanSignal / label-studio-frontend

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package
https://labelstud.io/
Apache License 2.0
415 stars 316 forks source link

JSON with multiple tasks doesn't work #1499

Open l-besiege-l opened 1 year ago

l-besiege-l commented 1 year ago

I am using version v1.4.0 of label-studio-frontend(installation of v1.8.0 via npm failed), and I provided the multiple tasks according to the documentation (https://labelstud.io/guide/tasks.html#Basic-Label-Studio-JSON-format) .

      task: [
        {
          annotations: [],
          predictions: [],
          id: 1,
          data: {
            text: '11111111111111111111111111111111',
          },
        },
        {
          annotations: [],
          predictions: [],
          id: 2,
          data: {
            text: '222222222222222222222222222222222',
          },
        },
      ],

However, I get an error when running it:

Uncaught (in promise) Error: [mobx-state-tree] No matching type for union ({ id: (number | null?); load: boolean?; auth: ({ enable: boolean?; username: string; password: string; to: string } | null?); data: (string | null?); queue: (string | null?)? } | null?)
    at ut (mobx-state-tree.module.js:3128:12)
    at t3.instantiate (mobx-state-tree.module.js:5435:19)
    at mobx-state-tree.module.js:4875:38
    at mobx-state-tree.module.js:4997:60
    at Array.forEach (<anonymous>)
    at t3.forAllProps (mobx-state-tree.module.js:4997:28)
    at t3.initializeChildNodes (mobx-state-tree.module.js:4874:14)
    at new t3 (mobx-state-tree.module.js:1277:41)
    at qe (mobx-state-tree.module.js:2913:12)
    at t3.instantiate (mobx-state-tree.module.js:4866:16)

How can I make LSF accept multiple tasks?

richardcoder commented 7 months ago

https://github.com/HumanSignal/label-studio-frontend/issues/1511#issuecomment-1871812429

hope this sample helps you, you dont need to use one single label-studio with multiple tasks (images). You can init / destroy label studio instance for each task (image), and switch between them.