stable-diffusion-xl-demo
stable-diffusion-xl-demo copied to clipboard
[suggestion] add aspect ratio options
colab dropdown, just turn it to html
# @param ["1:1", "4:1", "16:9", "5:2", "2:1", "7:4", "3:2", "8:7", "9:8", "8:9", "7:8", "2:3", "4:7", "1:2", "2:5", "1:3", "9:16"] {allow-input: true}
python code
aspect_ratio = "9:16"
max_pixel = 1024*1024
w, h = (int(e) for e in aspect_ratio.split(':'))
width, height = (round(math.sqrt(max_pixel * x / y) / 8) * 8 for x, y in ((w, h), (h, w)))
width
and height
can be the param of the param of the model
Great idea! Do you mind giving us a PR for this?