Spaces:
Running on Zero
Running on Zero
Commit ·
238c6e8
1
Parent(s): eb3c7aa
Bump output resolution to 1280 via MAX_OUTPUT_DIM constant
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -15,6 +15,7 @@ from PIL import Image
|
|
| 15 |
|
| 16 |
MAX_SEED = np.iinfo(np.int32).max
|
| 17 |
LANCZOS = getattr(Image, "Resampling", Image).LANCZOS
|
|
|
|
| 18 |
|
| 19 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 20 |
|
|
@@ -176,13 +177,13 @@ def b64_to_pil_list(b64_json_str):
|
|
| 176 |
|
| 177 |
def update_dimensions_on_upload(image):
|
| 178 |
if image is None:
|
| 179 |
-
return
|
| 180 |
w, h = image.size
|
| 181 |
if w > h:
|
| 182 |
-
nw =
|
| 183 |
nh = int(nw * h / w)
|
| 184 |
else:
|
| 185 |
-
nh =
|
| 186 |
nw = int(nh * w / h)
|
| 187 |
return (nw // 8) * 8, (nh // 8) * 8
|
| 188 |
|
|
|
|
| 15 |
|
| 16 |
MAX_SEED = np.iinfo(np.int32).max
|
| 17 |
LANCZOS = getattr(Image, "Resampling", Image).LANCZOS
|
| 18 |
+
MAX_OUTPUT_DIM = 1280
|
| 19 |
|
| 20 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 21 |
|
|
|
|
| 177 |
|
| 178 |
def update_dimensions_on_upload(image):
|
| 179 |
if image is None:
|
| 180 |
+
return MAX_OUTPUT_DIM, MAX_OUTPUT_DIM
|
| 181 |
w, h = image.size
|
| 182 |
if w > h:
|
| 183 |
+
nw = MAX_OUTPUT_DIM
|
| 184 |
nh = int(nw * h / w)
|
| 185 |
else:
|
| 186 |
+
nh = MAX_OUTPUT_DIM
|
| 187 |
nw = int(nh * w / h)
|
| 188 |
return (nw // 8) * 8, (nh // 8) * 8
|
| 189 |
|