Open notintricate opened 1 year ago
Hey there! As far as I understand it you have to create an instance of a controlnet_unit with all parameters you desire. In Addition when giving the instance to the im2img-function of the api-instance, you also have to enable use_deprecated_controlnet = True like this:
api_instance = webuiapi.WebUIApi(host="127.0.0.1", port=7861, sampler="Euler a", steps=30)
controlnet_image = "Your c-net image"
unit1 = webuiapi.ControlNetUnit(input_image=controlnet_image, module="canny", model="control_sd15_canny [fef5e48e]")
prompt = "Your Prompt"
image = "Your Image"
#When using Img2Img
result = api_instance.img2img(images=[image], prompt=prompt, controlnet_units=[unit1], use_deprecated_controlnet=True)
#When using Txt2Img
result = api_instance.txt2img(prompt=prompt, controlnet_units=[unit1], use_deprecated_controlnet=True)
When disabling "use_deprecated_controlnet" the controlnet-features will not activate. But thats just my take on the code at the moment.
is it possible to do it only with txt2img + a controlled image?
Using only img2img is kinda limited...
does not seem to work with alwayson scripts for me. what is sd_APIInterface?
There is API reference in SD to use control net, but no reference for these alwayson scripts
does not seem to work with alwayson scripts for me. what is sd_APIInterface?
There is API reference in SD to use control net, but no reference for these alwayson scripts
Hey, sorry for the confusion, I updated the codeexample. sd_APIinterface was a placeholder for webuiapi.
is it possible to do it only with txt2img + a controlled image?
Using only img2img is kinda limited...
Hey. Well i think it should be possible, looking at the code. Try to use api_instance.txt2img(...) instead api_instance.img2img(...) .
Sry to bother you ! I want to add more controlnet units in my code which use SD api to finish img2img.How to do that? My code is use "alwayson_scripts" too.
Can't get my head around this new implementation? How should we use controlnet_units now?