Mastering ComfyUI: Getting started with API - TUTORIAL

preview_player
Показать описание
Hello! As I promised, here's a tutorial on the very basics of ComfyUI API usage. Today, I will explain how to convert standard workflows into API-compatible formats and then use them in a Python script. Additionally, I will explain how to upload images or videos via the API for img2img or vid2vid usage.

*** Links from the Video Tutorial ***

Command to install websocket on python : pip install websocket-client
Рекомендации по теме
Комментарии
Автор

Thanks for this! It definitely put me on the right path. Only to thank you, a little tip: changing get_image method to

def get_image(filename, subfolder, folder_type):
data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
url_values = urllib.parse.urlencode(data)
img_data = requests.get("https://{}/view?{}".format(server_address, url_values)).content
return img_data

and your code to

...
for node_id in images:
for image_data in images[node_id]:
with open(f"{args.dest}/{filename}", 'wb') as handler:
handler.write(image_data)
...

metatags are preserved and dragging a file into ComfyUI loads the workflow and seeds data.

AldoZorzi
Автор

Very easy and useful to understand. Thank you!
Now, let's put this into a nice Frontend GUI :)

cyril
Автор

Damn you can't Imagine how much i love your Voice + Music in the background! I've never felt so good while i watched a Video. You have a awesome soothing voice! Thanks for this Video <'3

manuelhohmann
Автор

Very useful. Learning some advanced concepts from this channel. This can be very useful in building custom apps. Thank you 👏

banzai
Автор

That was a great explanation. How can I go about inpainting using two images: the original image and the mask data?

mahilkr
Автор

is possible to make comfyui into telegram bot? i want to make telegram bot wich it has face swap feature

gempyton
Автор

Nice Explanation. Where you able to download a video (from a video workflow) to a user specific folder ?

abrahamgeorgec
Автор

Thanks for the discovery, I program Python and this will be useful. I'm thinking on creating a script you can launch while playing roleplaying games so it generates portraits of NPCs on the fly. Can't wait to see those ideas you have!

I've yet to try the API scripting, but one question that comes to mind is the use of custom nodes. It is actually something that I don't have a good grasp using standard comfyUI. My doubt might be good content for a noob friendly short, maybe, and it is as follows: Theoretically you can import a workflow from an image because it is saved in the metadata. What is the behavior in the input nodes when you import this way? Does the prompt come filled? What happens to nodes that import images which, clearly, don't exist in your machine? And in the case of API formatted workflows, is there a way to specify the new nodes?

Maybe I'm overthinking, but my logic here is that custom nodes are analogous to importing libraries when programming: you have to hard-code the import at the beginning.

pericoel
Автор

Hey, I am getting error - ERROR: No matching distribution found for websockets-client

Roguefromearth
Автор

lol your voice is so good that i cant tell if its also AI 😅

mac
Автор

Someone should make a mobile app, which users set up with their own comfy URL and workflow a then provides simple UI to input images from the phone for inpainting or other stuff, using this API.

MsMadvas
Автор

Please show how we can link comfy to telegram bot

eveekiviblog
Автор

Traceback (most recent call last):
File "D:\BaiduSyncdisk\Proceduralization\default\4comfyui\batch_test0621.py", line 18, in <module>
prompt_workflow =

File "json\__init__.py", line 293, in load
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa8 in position 479: illegal multibyte sequence



dongyanghan
Автор

Just remove the piano track, very distracting.

ptmqffs