comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
49.69k stars 5.23k forks source link

How can i upload image through API? #1495

Closed anomySz closed 11 months ago

anomySz commented 12 months ago

Hi there,

I just wanna upload my local image file into server through api. is it possible?

When i was using ComfyUI, I could upload my local file using "Load Image" block. But, I don't know how to upload the file via api

the example code is this.

please let me know.

Thanks in advanced.

miabrahams commented 12 months ago

POST to /upload/image/.

There is an example at app/widgets.js at line 404. The definition is in server.py line 159.

juancopi81 commented 11 months ago

I am trying to upload an image as a mask, I found @routes.post("/upload/mask") but I have not been able to do it correctly, uploading the images is working ok now, but I still unsure about how to use upload mask, I tried:

original_ref = {
                'filename': mask,
                'type': 'input',
                'subfolder': 'input'
            }

And then I got this response:

Response: {'name': 'mask (3).png', 'subfolder': '', 'type': 'input'}

Any example about how to use it?

Thanks

mcmonkey4eva commented 11 months ago

that response means your file was uploaded, and is named mask (3).png and you can now use it in a workflow by that name

lianshuailong0715 commented 2 months ago

POST to /upload/image/.

There is an example at app/widgets.js at line 404. The definition is in server.py line 159.

Can you provide a demo example for Image2Image pipeline or txt2img pipeline with Controlnet as https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/websockets_api_example.py

LianShuaiLong commented 2 months ago

Can you provide a demo example for Image2Image workflow or txt2img workflow with Controlnet as https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/websockets_api_example.py

el0911 commented 1 month ago

upload/image

line 404 am i the only one that finds that comedic?