Skip to content

Commit 7768e88

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ 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")
309+
)
307310
) {
308311
return response;
309312
}

0 commit comments

Comments
 (0)