opparco / stable-diffusion-webui-two-shot

Latent Couple extension (two shot diffusion port)
MIT License
720 stars 152 forks source link

Any way to pass the Latent couple settings through automatic1111 API? #33

Open yiouyou opened 1 year ago

yiouyou commented 1 year ago

I'm using automatic1111 API to call txt2img/img2img process and would like to take the advantage of Latent couple extension. But have no idea how to pass the settings to the extension through API.

Need some help if possible, Thanks a lot!

funkey7dan commented 1 year ago

I'm stuck in the same boat, Did you find a solution?

huw12313212 commented 1 year ago

I also want to integrate the functionality of Latent Couple with other applications, but I cannot find any relevant documentation for the Restful API. Does anyone have any clues? Thank you.

funkey7dan commented 1 year ago

It seems I found a way to make it work: in a recent commit "alwayson_scripts" field was added in the API payload options. You can add the name of the extension and list its arguments, like this for example:

"alwayson_scripts": {'Latent Couple extension':{"args":[True,
                                                      "1:1,1:2,1:2",
                                                      "0:0,0:0,0:1",
                                                      "0.5,0.8,0.8",30]}}

To find the arguments and title for the script I had to check the source code, "title" field in the Script class of the extension source code, and to get arguments check "process_script_params" function.