mix1009 / sdwebuiapi

Python API client for AUTOMATIC1111/stable-diffusion-webui
MIT License
1.35k stars 181 forks source link

How to make input_image the right format? #131

Open derekcbr opened 10 months ago

derekcbr commented 10 months ago

image0 = Image.open("C:\city.pang") unit1 = webuiapi.ControlNetUnit(input_image=image0, module='canny', model='control_canny-fp16 [e3fe7712]') But it shows an error TypeError: Object of type PngImageFile is not JSON serializable How to get the right input image format?

davidmartinrius commented 9 months ago

You need to do like this. The input file must be a PIL object:

from PIL import Image

image0 = Image.open("C:\city.pang")
unit1 = webuiapi.ControlNetUnit(input_image=image0, module='canny', model='control_canny-fp16 [e3fe7712]')