Skip to content
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

Widget Image Segmentation #378

Merged
merged 52 commits into from
Nov 4, 2021
Merged

Widget Image Segmentation #378

merged 52 commits into from
Nov 4, 2021

Conversation

mishig25
Copy link
Contributor

@mishig25 mishig25 commented Sep 30, 2021

Implemented image segmentation widget.

Request to Inference API (same as input for Image Classification widget):

const requestBody = { file }; // file is an image file

Response from Inference API:

Array<{ 
    label: string; 
    score: number;
    mask: string 
}>

Sample output:

[
    {"score": 0.9982, "label": "remote", "mask": "iVHIJKLMNOPQRSTUVWXYZabcd..."},
    {"score": 0.9955, "label": "couch", "mask": "iVHIJKLMNOPQRSTUVWXYZabcd..."},
    {"score": 0.9987, "label": "cat", "mask": "iVHIJKLMNOPQRSTUVWXYZabcd..."}
]

Screenshots:

success state success state (mask selected)
Screenshot 2021-09-30 at 17 13 27 Screenshot 2021-09-30 at 17 13 41
initial state error state
Screenshot 2021-09-30 at 17 13 10 Screenshot 2021-09-30 at 17 14 36

Check out the interactive netlify demo

cc: @Narsil @osanseviero @NielsRogge

Update 1: demo should be working on Safari as well

@mishig25 mishig25 added the widgets About our Inference widgets label Sep 30, 2021
@julien-c
Copy link
Member

This looks super cool!

(but the link to netlify is just regular object detection for now, no?)

@mishig25
Copy link
Contributor Author

mishig25 commented Oct 1, 2021

@julien-c try the demo now 👍 https://615a24ebbb69fc346548d87c--huggingface-widgets.netlify.app/

@julien-c
Copy link
Member

julien-c commented Oct 1, 2021

WOW 😮

@osanseviero
Copy link
Member

Very excited about this!!! It looks too good

@gary149
Copy link
Contributor

gary149 commented Oct 1, 2021

Awesome 😎. Found an issue on iOS: the browse image button works it opens my images library then I select an image but nothing happens.
Edit: I just saw your comment on safari so I guess it's expected

@beurkinger

This comment has been minimized.

@beurkinger beurkinger self-requested a review October 28, 2021 11:49
@Narsil

This comment has been minimized.

@Narsil
Copy link
Contributor

Narsil commented Oct 29, 2021

Backend fixed !

@beurkinger
Copy link
Contributor

beurkinger commented Nov 2, 2021

I get an error message while trying to run your branch:

> huggingface-widgets@0.0.1 dev /Users/thibault/Documents/web/moon-landing/server/huggingface_hub/widgets
> svelte-kit dev

 > html:/Users/thibault/Documents/web/moon-landing/server/huggingface_hub/widgets/src/routes/index.svelte:4:13: error: Expected "from" but found "{"
    4 │ ... type { Model...
      ╵    

I think but we should put lang="ts" in every <script /> tag, as it's the recommend way of proceeding by the Svelte/SvelteKit documentation. Actually I think we had more or loess decided to do it with @Pierrci, but never got around to doing it ?

Note: this error appeared after I ran npm i, which updated svelte-kit. It may well be that the next version of SvelteKit isn't compatible with the parser option that allows us to get away with not putting lang="ts" in script tags - I think I remember reading that it was deprecated (?).

@mishig25
Copy link
Contributor Author

mishig25 commented Nov 2, 2021

@beurkinger please let me know if you have any other comments on this PR.

In terms of:

huggingface-widgets@0.0.1 dev /Users/thibault/Documents/web/moon-landing/server/huggingface_hub/widgets
svelte-kit dev

we should probably take care of it in different PR

@mishig25
Copy link
Contributor Author

mishig25 commented Nov 3, 2021

Will merge it after I merge huggingface/transformers#14062 & Inference API is updated

@mishig25 mishig25 merged commit cc692f5 into main Nov 4, 2021
@mishig25 mishig25 deleted the widget_img_seg branch November 4, 2021 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widgets About our Inference widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants