Spaces:
Running on Zero
Running on Zero
Commit ·
2cf368d
1
Parent(s): a3f2ffd
Add max_dim_for_mode to dimensions (missed in earlier commit)
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- dimensions.py +3 -0
dimensions.py
CHANGED
|
@@ -2,6 +2,9 @@ MAX_OUTPUT_DIM = 2048
|
|
| 2 |
MAX_OUTPUT_DIM_FAST = 768
|
| 3 |
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
def compute_output_dimensions(w, h, max_dim=MAX_OUTPUT_DIM):
|
| 6 |
# Pin the long side to max_dim and scale the short side proportionally.
|
| 7 |
# We snap to the nearest multiple of 8 (not floor) to minimise aspect ratio
|
|
|
|
| 2 |
MAX_OUTPUT_DIM_FAST = 768
|
| 3 |
|
| 4 |
|
| 5 |
+
def max_dim_for_mode(mode): return MAX_OUTPUT_DIM_FAST if mode == "fast" else MAX_OUTPUT_DIM
|
| 6 |
+
|
| 7 |
+
|
| 8 |
def compute_output_dimensions(w, h, max_dim=MAX_OUTPUT_DIM):
|
| 9 |
# Pin the long side to max_dim and scale the short side proportionally.
|
| 10 |
# We snap to the nearest multiple of 8 (not floor) to minimise aspect ratio
|