Skip to content

Commit 1e88330

Browse files
committed
fix(hf-inference): image segmentation
related: #1430 Signed-off-by: Raphael Glon <[email protected]>
1 parent a27b5b4 commit 1e88330

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ 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" && typeof x.mask === "string" && (!("score" in x) || typeof x.score === "number"))
307309
) {
308310
return response;
309311
}

0 commit comments

Comments
 (0)