Commit 2c5934d
committed
Accept null score in hf-inference image-segmentation response
The image-segmentation output schema declares score as optional
(packages/tasks/src/tasks/image-segmentation/inference.ts: score?: number),
but the runtime validator in HFInferenceImageSegmentationTask only
accepted undefined or a number, rejecting null with:
API Implementation Error: TypeError: Invalid output: output must be
of type Array<{label:string; score:number; mask: string}>
Several HF-Inference models (e.g. jonathandinu/face-parsing) return
null for score on per-segment masks, which is consistent with the
optional schema field but tripped the strict type guard.
Allow null alongside undefined and number.
Refs #14301 parent 3f590d2 commit 2c5934d
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
0 commit comments