-
Notifications
You must be signed in to change notification settings - Fork 372
fix(hf-inference): image segmentation #1431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1e88330
to
7768e88
Compare
response.every((x) => typeof x.label === "string" && typeof x.mask === "string" && typeof x.score === "number") | ||
response.every( | ||
(x) => | ||
typeof x.label === "string" && typeof x.mask === "string" && (!("score" in x) || typeof x.score === "number") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof x.label === "string" && typeof x.mask === "string" && (!("score" in x) || typeof x.score === "number") | |
typeof x.label === "string" && typeof x.mask === "string" && (x.score === undefined || typeof x.score === "number") |
i think you can just do this (more TS-idiomatic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just ignore the type checks on score
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah my bad I changed it and erased the change by mistake (push force)
-> done: removed the whole type check on score, as we prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm it's better to type check no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the type is score?: number;
it's a valid type, we don't want random objects or string, just an optional number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c9a51fb
to
e737a5c
Compare
Array.isArray(response) && | ||
response.every((x) => typeof x.label === "string" && typeof x.mask === "string" && typeof x.score === "number") | ||
) { | ||
if (Array.isArray(response) && response.every((x) => typeof x.label === "string" && typeof x.mask === "string")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Array.isArray(response) && response.every((x) => typeof x.label === "string" && typeof x.mask === "string")) { | |
if (Array.isArray(response) && response.every((x) => typeof x.label === "string" && typeof x.mask === "string" && (x.score === undefined || typeof x.score === "number"))) { |
e737a5c
to
738bd8e
Compare
related: #1430 Signed-off-by: Raphael Glon <[email protected]>
738bd8e
to
e972cab
Compare
related: #1430