Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call WebUI API #49

Open
dyn-do opened this issue May 7, 2023 · 10 comments
Open

How to call WebUI API #49

dyn-do opened this issue May 7, 2023 · 10 comments

Comments

@dyn-do
Copy link

dyn-do commented May 7, 2023

I'd like to execute the Latent Couple Extension via the API for programmatic control.
I would appreciate any guidance on how to pass parameters, or any modifications needed to achieve this.

@KimMatt
Copy link

KimMatt commented Jun 16, 2023

+1

@aschier
Copy link

aschier commented Jun 22, 2023

We could also use an API integration.

@twitset
Copy link

twitset commented Jun 26, 2023

It would be great to be able to pass masks through the API also

@skun
Copy link

skun commented Jul 4, 2023

We could also use an API integration.

How do you integrate Latent Couple parameters using the API? Can I take a look?

@skun
Copy link

skun commented Jul 4, 2023

It would be great to be able to pass masks through the API also

How do you integrate Latent Couple parameters using the API? Can I take a look?

@liuxueyuanzhi
Copy link

+1

1 similar comment
@old90
Copy link

old90 commented Aug 12, 2023

+1

@marcsyp
Copy link

marcsyp commented Sep 29, 2023

Agreed on passing Mask images to the API, this would be absolutely crucial to some of my work. In the meantime, a few things.

  1. The current API on the officially linked extension installed by A1111 has the following args using always_on_scripts:

alwayson_scripts={
'latent couple extension': {
"args": [
{
"enabled ": False,
"divisions": "1:1,1:2,1:2",
"positions": "0:0,0:0,0:1",
"weights": "0.2,0.8,0.8",
"end_at_step": 20
}
]
}
}

  1. There is a fork that appears to have implemented a mask input, but I don't see a color list input so I am confused at how the subprompts would be assigned to the mask if there is no way to order the mask regions by subprompt. Unfortunately the repo fork doesn't have any documentation or issues enabled (@aria1th), so it can be difficult to understand what is in store for us there:

aria1th@77f5fa8

@aria1th
Copy link

aria1th commented Sep 29, 2023

@marcsyp I enabled the issue (I'm not sure why it was disabled by default...)
The color is parsed from [0, 0, 0] to [255, 255, 255] in sorted order.
The behavior is described here : ashen-sensored#4

    alwayson_scripts={
        'latent couple extension': {
            "args" : [ # enabled,
                'Mask',
                # raw_divisions, raw_positions, raw_weights, raw_end_at_step, alpha_blend, *cur_weight_sliders, 
                '1:1,1:2,1:2','0:0,0:0,0:1', '0.2,0.8,0.8', 150, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
                , #sketch at last
                True, #denoise mask argument
                webuiapi.raw_b64_img(region_prompt_img) #base64 encoded image
            ]
        },
        },

For most cases, you would use black background so it will be first prompt, then maybe Blue, (0, 0, 255), then Green(0, 255, 0), Red (255, 0, 0).

But for safety and JPG types color degradation, there is mask denoising at default (and some image resizing for some optimization)

@hexiaochun
Copy link

use this test:

`
{
"prompt": "A Man and A Woman AND A Man and A Woman (student),(1boy),(underage),(white skin),(short hair),(black hair/black eyes),(white school uniform) AND A Man and A Woman (student),(1girl),(underage),(white skin),(black straight hair),(flat chest),(school uniform),(fishnets),",
"negative_prompt": "",
"sampler_name": "Euler a",
"batch_size": 1,
"n_iter": 1,
"steps": 30,
"cfg_scale": 7,
"width": 512,
"height": 512,
"restore_faces": true,
"denoising_strength": 0,
"save_images": false,
"alwayson_scripts":{"Latent Couple extension":{"args":["True","1:1,1:2,1:2","0:0,0:0,0:1","0.2,0.8,0.8",30]}}

}
`

this ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants