Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suggestion] add aspect ratio options #8

Open
YuenSzeHong opened this issue Aug 25, 2023 · 1 comment
Open

[suggestion] add aspect ratio options #8

YuenSzeHong opened this issue Aug 25, 2023 · 1 comment

Comments

@YuenSzeHong
Copy link

YuenSzeHong commented Aug 25, 2023

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

@TonyLianLong
Copy link
Owner

Great idea! Do you mind giving us a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants