R
RunPod2mo ago
Monster

is there example code to access the runpod-worker-comfy serverless endpoint

Hi, I have managed to run the runpod-worker-comfy serverless endpoint. and I know it supports for 5 entries: RUN, RUNSYNC, STATUS, CANCEL, HEALTH. but I do not exactly know how to access the service from my python code. like how to prepare the api-key, the worker id, how to prepare the request for RUN, and how to check the status until it is finished, and download the generated image. anywhere exists a example code to do these basic operation from my python code? Previously I have python code to communicate directly with the comfyUI server, which will create a websocket, send the workflow with http post, keep checking the history, once the work is done, read the image from the output which passed through the websocket connection. but when wrapped with runpod-worker-comfy, indeed, the interface is more easy, and there is input validation which is great. but I do not know how to use it from my code, and did not find any example code to access it, sorry for my ignorance.
17 Replies
digigoblin
digigoblin2mo ago
Which version are you using?
Monster
Monster2mo ago
your version
digigoblin
digigoblin2mo ago
There are a few different Github repos I don't have one
Monster
Monster2mo ago
the one you recommanded. from ashly
digigoblin
digigoblin2mo ago
Look in the "tests" directory of the repo, there are example scripts there Copy .env.example to .env then put in your API key and endpoint id Then the custom.py is a good one to use to test your workflows.
Monster
Monster2mo ago
yes, I saw it, even it has a util.py very comprehensive the example is a text to image example, I wonder it will work for image to image, becasue there is a very tricky thing, when you upload the image, the comfyUI might give a different name in the ./input folder to use. not sure this is considered by the rp_handler.py. anyway I will try
digigoblin
digigoblin2mo ago
I said use custom.py not txt2img.py You can do whatever you want with custom.py
Monster
Monster2mo ago
yes, sure, I will try it first, I am still in the dark, not sure what I am saying. sorry.
nerdylive
nerdylive2mo ago
Read the docs from runpod It will surely help you understand the run runsyc status and other
Monster
Monster2mo ago
@nerdylive yes, I am reading, I will do my homework before asking silly questions 🙂 thx
nerdylive
nerdylive2mo ago
nice hahah, all good
Monster
Monster2mo ago
@digigoblin sorry I made a mistake, I used different version of runpod-worker-comfy, the version from blib-la this one https://github.com/blib-la/runpod-worker-comfy.git
GitHub
GitHub - blib-la/runpod-worker-comfy: ComfyUI as a serverless API o...
ComfyUI as a serverless API on RunPod. Contribute to blib-la/runpod-worker-comfy development by creating an account on GitHub.
Monster
Monster2mo ago
do you have any idea is there any example code to access the serverless endpoint for this one? I prefer to use blib-la version because I have built everything and customised based on this.
digigoblin
digigoblin2mo ago
I can't help you with this, I use the ashleyk one
Monster
Monster2mo ago
ok, understood. but can we build a serverless handler simply pass all requests to the internal comfyUI server. as I already have my own code to communicate with comfyUI server directly. I just want to use the serverless machanism instead of keep the pod running
digigoblin
digigoblin2mo ago
No, you can't do that, serverless payload format is different It requires input field.
Monster
Monster2mo ago
ok