Open dyn-do opened 1 year ago
+1
We could also use an API integration.
It would be great to be able to pass masks through the API also
We could also use an API integration.
How do you integrate Latent Couple parameters using the API? Can I take a look?
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?
+1
+1
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 } ] } }
2) 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:
@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 : https://github.com/ashen-sensored/stable-diffusion-webui-two-shot/pull/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)
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
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.