Commit
•
e00ae5a
1
Parent(s):
996f8c3
Update handler.py
Browse files- handler.py +5 -5
handler.py
CHANGED
@@ -116,12 +116,12 @@ class GenerationConfig:
|
|
116 |
total_pixels = self.width * self.height
|
117 |
if total_pixels > MAX_TOTAL_PIXELS:
|
118 |
scale = (MAX_TOTAL_PIXELS / total_pixels) ** 0.5
|
119 |
-
self.width = max(
|
120 |
-
self.height = max(
|
121 |
else:
|
122 |
-
# Round dimensions to nearest multiple of
|
123 |
-
self.width = max(
|
124 |
-
self.height = max(
|
125 |
|
126 |
# Adjust number of frames to be in format 8k + 1
|
127 |
k = (self.num_frames - 1) // 8
|
|
|
116 |
total_pixels = self.width * self.height
|
117 |
if total_pixels > MAX_TOTAL_PIXELS:
|
118 |
scale = (MAX_TOTAL_PIXELS / total_pixels) ** 0.5
|
119 |
+
self.width = max(128, min(MAX_LARGE_SIDE, round(self.width * scale / 16) * 16))
|
120 |
+
self.height = max(128, min(MAX_LARGE_SIDE, round(self.height * scale / 16) * 16))
|
121 |
else:
|
122 |
+
# Round dimensions to nearest multiple of 16
|
123 |
+
self.width = max(128, min(MAX_LARGE_SIDE, round(self.width / 16) * 16))
|
124 |
+
self.height = max(128, min(MAX_LARGE_SIDE, round(self.height / 16) * 16))
|
125 |
|
126 |
# Adjust number of frames to be in format 8k + 1
|
127 |
k = (self.num_frames - 1) // 8
|