huggingface / huggingface.js

Utilities to use the Hugging Face Hub API
https://hf.co/docs/huggingface.js
MIT License
1.33k stars 188 forks source link

imageToImage inpainting? #230

Open UXDart opened 1 year ago

UXDart commented 1 year ago

Hello. using imageToImage inference nodejs library, is it possible to use a model for inpainting? did some tests but get an error that the model pipeline is not supported. but could be the models I tried didn't support it. is this possible? is the mask, the transparent pixels of the image sent? Thanks

coyotte508 commented 1 year ago

Maybe @radames you have some ideas?

UXDart commented 1 year ago

for example https://huggingface.co/runwayml/stable-diffusion-inpainting under inference says Text To Image... is this because is not supported? tested sending mask in different ways but it doesn't work. get back after some time, it is doing something... "Model type not found or pipeline not implemented"

UXDart commented 1 year ago

looking at the source code of JS HF library it seems this would not be img2img really? is there a way to do a custom call to the API to send the mask? thanks (of course this could be done in a "space" but would like to inference a model via API if possible)

coyotte508 commented 1 year ago

you can do custom api call, with .request()

See this example from the README:

// Custom call, for models with custom parameters / outputs
await hf.request({
  model: 'my-custom-model',
  inputs: 'hello world',
  parameters: {
    custom_param: 'some magic',
  }
})
UXDart commented 1 year ago

Thanks! or I'm sending the wrong parameter or we need a new pipeline/task... get back error "Model type not found or pipeline not implemented". to be sure, also did a custom request for text to image, and it worked. also it could be that if the task is not supported then api inference is auto-disabled?

UXDart commented 1 year ago

ok, it works using a space, but if someone is paying for HF... that person should be able to use the model without being in a queue in the gradio space. is it possible to add a task "inpaint" or something like that? thank you!

coyotte508 commented 9 months ago

@merveenoyan @osanseviero do you know if we have a task that includes inpainting?

pcuenca commented 9 months ago

Well, @xenova added a sub-task yesterday in this PR: https://github.com/huggingface/huggingface.js/pull/357/files#diff-8b3b4279b1381c00a2825a978eca266b637c34a17eced482517ad9156ab5655aR440

Not sure what else is needed to make it work, happy to take a look.