label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

Impossible to edit Audio prediction in TextArea

Open RK-BAKU opened this issue 2 years ago • 1 comments

Trying to edit prediction text throws exception:

Uncaught Error: [mobx-state-tree] No matching type for union ((string | string[]) | undefined?)

Full exception traceback at the end of this report.

And text in the textarea becomes:

[object Object]

Here is the Template:

<View>
  <Audio name="audio" value="$audio" zoom="true" hotkey="ctrl+enter"/>
  <Header value="Transcription"/>
  <TextArea name="transcription" transcription="true" toName="audio" rows="4" editable="true" maxSubmissions="1" required="true"/>
</View>

Here is the data of task:

{
  "id": 2749,
  "data": {
    "audio": "/v11/example.mp3"
  },
  "annotations": [],
  "predictions": [
    {
      "id": 517,
      "model_version": "INITIAL",
      "created_ago": "3 minutes",
      "result": [
        {
          "from_name": "transcription",
          "id": "0001af31059beddc76f4fcfe9a50e955_0",
          "to_name": "audio",
          "type": "textarea",
          "value": {
            "text": [
              "test prediction text, masked example"
            ]
          }
        }
      ],
      "score": null,
      "cluster": null,
      "neighbors": null,
      "mislabeling": 0,
      "created_at": "2022-08-27T10:15:35.182884Z",
      "updated_at": "2022-08-27T10:15:35.182929Z",
      "task": 2749
    }
  ]
}

Exception traceback:

Uncaught Error: [mobx-state-tree] No matching type for union ((string | string[]) | undefined?)
    at na (mobx-state-tree.module.js:3128:12)
    at t.reconcile (mobx-state-tree.module.js:5441:19)
    at t.willChange (mobx-state-tree.module.js:4901:41)
    at io (mobx.module.js:3006:35)
    at e.write (mobx.module.js:4147:26)
    at Object.set [as text] (mobx.module.js:4380:29)
    at Object.setValue (Result.js:228:33)
    at Xn (mobx.module.js:928:19)
    at r (mobx.module.js:915:16)
    at mobx-state-tree.module.js:2593:35
    at Oi (mobx-state-tree.module.js:2456:16)
    at Object.r (mobx-state-tree.module.js:2483:16)
    at Object.setValue (AreaMixin.js:159:36)
    at Xn (mobx.module.js:928:19)
    at r (mobx.module.js:915:16)
    at mobx-state-tree.module.js:2593:35
    at Oi (mobx-state-tree.module.js:2456:16)
    at Object.r (mobx-state-tree.module.js:2483:16)
    at Object.onChange (TextArea.js:192:26)
    at Xn (mobx.module.js:928:19)
    at r (mobx.module.js:915:16)
    at mobx-state-tree.module.js:2593:35
    at Oi (mobx-state-tree.module.js:2456:16)
    at Object.r (mobx-state-tree.module.js:2483:16)
    at Object.setValue (TextAreaRegion.js:42:19)
    at Xn (mobx.module.js:928:19)
    at r (mobx.module.js:915:16)
    at mobx-state-tree.module.js:2593:35
    at Oi (mobx-state-tree.module.js:2456:16)
    at Object.r (mobx-state-tree.module.js:2483:16)
    at o.onChange (TextAreaRegion.js:84:12)
    at Object.Ue (react-dom.production.min.js:52:317)
    at Ye (react-dom.production.min.js:52:471)
    at react-dom.production.min.js:53:35
    at Or (react-dom.production.min.js:100:68)
    at Nr (react-dom.production.min.js:101:380)
    at react-dom.production.min.js:113:65
    at De (react-dom.production.min.js:292:189)
    at react-dom.production.min.js:50:57
    at Lr (react-dom.production.min.js:105:469)
    at Jt (react-dom.production.min.js:75:265)
    at Zt (react-dom.production.min.js:74:124)
    at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at Go (react-dom.production.min.js:122:325)
    at je (react-dom.production.min.js:292:48)
    at Xt (react-dom.production.min.js:73:352)
    at HTMLDivElement.r (helpers.js:72:23)
    at HTMLDivElement.c (rocket-loader.min.js:1:9405)
na @ mobx-state-tree.module.js:3128
t.reconcile @ mobx-state-tree.module.js:5441
t.willChange @ mobx-state-tree.module.js:4901
io @ mobx.module.js:3006
e.write @ mobx.module.js:4147
set @ mobx.module.js:4380
setValue @ Result.js:228
Xn @ mobx.module.js:928
r @ mobx.module.js:915
(anonymous) @ mobx-state-tree.module.js:2593
Oi @ mobx-state-tree.module.js:2456
r @ mobx-state-tree.module.js:2483
setValue @ AreaMixin.js:159
Xn @ mobx.module.js:928
r @ mobx.module.js:915
(anonymous) @ mobx-state-tree.module.js:2593
Oi @ mobx-state-tree.module.js:2456
r @ mobx-state-tree.module.js:2483
onChange @ TextArea.js:192
Xn @ mobx.module.js:928
r @ mobx.module.js:915
(anonymous) @ mobx-state-tree.module.js:2593
Oi @ mobx-state-tree.module.js:2456
r @ mobx-state-tree.module.js:2483
setValue @ TextAreaRegion.js:42
Xn @ mobx.module.js:928
r @ mobx.module.js:915
(anonymous) @ mobx-state-tree.module.js:2593
Oi @ mobx-state-tree.module.js:2456
r @ mobx-state-tree.module.js:2483
o.onChange @ TextAreaRegion.js:84
Ue @ react-dom.production.min.js:52
Ye @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
Or @ react-dom.production.min.js:100
Nr @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Lr @ react-dom.production.min.js:105
Jt @ react-dom.production.min.js:75
Zt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
je @ react-dom.production.min.js:292
Xt @ react-dom.production.min.js:73
r @ helpers.js:72
c @ rocket-loader.min.js:1

RK-BAKU avatar Aug 27 '22 10:08 RK-BAKU

UPDATE

Seems it's impossible to edit anything contained in TextArea whenever ML is connected or not. Trying to edit prev annotations results the same error. Looks like a UI bug after update... Cleaned cache, used incognito mode, etc... Nothing helps.

STEP 1 - OPEN ANY TASK (CONNECTED TO ML BACKEND OR NOT)

Label Studio 1

STEP 2 - CLICK ANY BUTTON WITHIN TEXT

Label Studio 2

RK-BAKU avatar Aug 27 '22 13:08 RK-BAKU