Skip to content

Commit 1dcc11a

Browse files
authored
fix(hf-inference): image segmentation (#1431)
related: #1430 Signed-off-by: Raphael Glon <[email protected]> Co-authored-by: Raphael Glon <[email protected]>
1 parent a4e8f37 commit 1dcc11a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/inference/src/providers/hf-inference.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ export class HFInferenceImageSegmentationTask extends HFInferenceTask implements
303303
override async getResponse(response: ImageSegmentationOutput): Promise<ImageSegmentationOutput> {
304304
if (
305305
Array.isArray(response) &&
306-
response.every((x) => typeof x.label === "string" && typeof x.mask === "string" && typeof x.score === "number")
306+
response.every(
307+
(x) =>
308+
typeof x.label === "string" &&
309+
typeof x.mask === "string" &&
310+
(x.score === undefined || typeof x.score === "number")
311+
)
307312
) {
308313
return response;
309314
}

0 commit comments

Comments
 (0)