#API IMG2IMG

1 messages · Page 1 of 1 (latest)

craggy citrus
#

Hello guys, I wanted to do this more detailed but my PC just died.

I was working on a small gradio app, using comfyui custom workflows as presets API from swarm t2i works perfectly but i2i didn't work

Using a swarm image base 64 input node, I had to manually copy paste the omg base 64 code 1m characters I think. the workflow worked
But in the swarm ui it wouldn't let me upload an image.

If I use an image input it works in the comfyui backend and in the swarm but it wasn't working in the gradio

So my question is there an example of a custom workflow, saved into a preset and used as an API call I can use to understand how to build the gradio app?

I've asked around to a few friends in the forum they helped a lot but I'm still stuck. If really appreciate an example on how to do this if someone had already done this please help.

delicate skiff
#

You should post the errors and the workflow.

#

The API calls would also help see what you are doing. Someone may be able to see the issue.

craggy citrus
#

so this is the basic comfyui workflow i staretd with somkething very simple so i can move onto more compelx workflows.

my problem is how im feeding the image to the workflow, base64 load image? TO USE IT VIA api PRESET

craggy citrus
#

Invalid operation: ComfyUI execution error: Incorrect padding

I GET THAT ERRROR USING SWARMINPUTIMAGE node

#

works in simple gen tab

craggy citrus
#

thats from the swamr log trying to use init image in generate

craggy citrus
#

using this my error is
}
2024-07-24 13:26:04,003 - INFO - API Response: {
"error": "Invalid operation: ComfyUI execution error: Incorrect padding"
}

#

using this
raise ValueError(f"API Error: {response_data['error']}")
ValueError: API Error: Invalid operation: ComfyUI execution error: cannot identify image file <_io.BytesIO object at 0x000001EB1B5D67A0>

#

using that i get a 748k character code that nukes my pc

craggy citrus
#

2024-07-24 14:05:50,650 - INFO - Image2Image mode activated
2024-07-24 14:06:00,051 - ERROR - An error occurred: cannot identify image file <_io.BytesIO object at 0x0000019F71625080>
2024-07-24 14:06:24,498 - INFO - Image2Image mode activated
2024-07-24 14:06:24,734 - ERROR - API Error: Invalid operation: ComfyUI execution error: Incorrect padding
2024-07-24 14:06:35,470 - INFO - Image2Image mode activated
2024-07-24 14:06:42,877 - ERROR - An error occurred: cannot identify image file <_io.BytesIO object at 0x0000019F71624D10>

same errrors than in swamr

craggy citrus
#

I know it's probably something very dumb but idk how to fix this

woeful frost
#

when calling from API, you'll want to look at how the Simple tab calls it

#

atm it's a bit hacky, the UI tracks the comfy workflow data and sends it up to the swarm server to reprocess

#

(ie the swarm server itself atm does not properly process the workflow on its own atm)

#

(this needs fixing, it is very silly that it works this way)

craggy citrus
#

Hello sir okay thank you so much I'll check the simple tab and how it calls the workflow I think I made it work once there

#

I've been looking at this to interact with comfyui API directly

#

Doesn't know if it could be a solution? Since it wraps the whole workflow inside it . Maybe even allowing for text and image to video

woeful frost
craggy citrus
craggy citrus
woeful frost
#

images: base64

#

video, idk

delicate skiff
craggy citrus
#

Okay thanks guys I won't sleep untill I fix this with this new help

#

Thank you so much

delicate skiff
#

@woeful frost uh, what am I doing wrong here I cant send init image to comfy workflow in generate tab either.

Create simple img2img workflow use SwarmLoadImageB6, save workflow, go to generate tab choose init image and toggle Custom Workflow with the one I just saved.

It errors because no image is loaded. Hitting F12 init image is included with my base64 in the call.

2024-07-30 21:45:05.030 [Debug] Refused to generate image for local: Invalid operation: ComfyUI execution error: cannot identify image file <_io.BytesIO object at 0x7ff8adc8ea20>

Does this not work the way I think it does? This is the same issue Onyx was having.

woeful frost
#

use the button

#

i needa hide that selector deeper down the Very Advanced Usages Only hole

delicate skiff
#

Why does sending initimage param and comfyuicustomworkflow: test 2 not just load that image into the base 64 node and run the workflow?

delicate skiff
# woeful frost ` Create simple img2img workflow use SwarmLoadImageB6, save workflow, go to gene...

clicked send to generate tab chose image and clicked generate 2024-07-30 23:07:59.912 [Info] User local requested 1 image with model 'starlightXL.safetensors'... 2024-07-30 23:07:59.912 [Debug] [BackendHandler] Backend request #25 for model starlightXL.safetensors, maxWait=7.00:00:00. 2024-07-30 23:07:59.912 [Debug] [BackendHandler] Backend request #25 found correct model on #0 2024-07-30 23:07:59.912 [Debug] [BackendHandler] Backend request #25 finished. 2024-07-30 23:08:00.168 [Debug] Refused to generate image for local: Invalid operation: Collection was modified; enumeration operation may not execute.

woeful frost
# delicate skiff The workflow I used

this workflow has a manual parameter (SwarmInputCheckpoint) and therefore no parameters are autoclaimed, ie you do not have an Init Image input at all

pine steppe
woeful frost
pine steppe
#

Thanks @woeful frost only /Text2Image is mentioned here as route thats why i was wondering.

#

so calling /Imag2Image should work too

woeful frost
#

look at the UI at all first before the API lol

#

"img2img" as some old UIs (auto) have called it, in swarm is just Init Image, a parameter on the same tab as everything else

pine steppe
woeful frost
#

do a gen with an init image, and look at the network traffic, and that'll show you exactly how to do it as an api call

pine steppe
#

Yes will investigate it. Ive played with A1111 API but not the Comfy one yet and nor with Swarm. I think i know what you mean. Init img is just variables of text2image call.