Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,19 +78,19 @@ def translate_albanian_to_english(text):
|
|
| 78 |
# --- Dimension Calculation ---
|
| 79 |
def _calculate_new_dimensions_wan(pil_image):
|
| 80 |
if pil_image is None:
|
| 81 |
-
return
|
| 82 |
|
| 83 |
orig_w, orig_h = pil_image.size
|
| 84 |
if orig_w <= 0 or orig_h <= 0:
|
| 85 |
-
return
|
| 86 |
|
| 87 |
# Set the smaller dimension to 384
|
| 88 |
aspect_ratio = orig_h / orig_w
|
| 89 |
if orig_h <= orig_w:
|
| 90 |
-
target_h =
|
| 91 |
target_w = round(target_h / aspect_ratio)
|
| 92 |
else:
|
| 93 |
-
target_w =
|
| 94 |
target_h = round(target_w * aspect_ratio)
|
| 95 |
|
| 96 |
# Ensure dimensions are multiples of MOD_VALUE
|
|
|
|
| 78 |
# --- Dimension Calculation ---
|
| 79 |
def _calculate_new_dimensions_wan(pil_image):
|
| 80 |
if pil_image is None:
|
| 81 |
+
return 416, 416 # Default to square if no image
|
| 82 |
|
| 83 |
orig_w, orig_h = pil_image.size
|
| 84 |
if orig_w <= 0 or orig_h <= 0:
|
| 85 |
+
return 416, 416
|
| 86 |
|
| 87 |
# Set the smaller dimension to 384
|
| 88 |
aspect_ratio = orig_h / orig_w
|
| 89 |
if orig_h <= orig_w:
|
| 90 |
+
target_h = 416
|
| 91 |
target_w = round(target_h / aspect_ratio)
|
| 92 |
else:
|
| 93 |
+
target_w = 416
|
| 94 |
target_h = round(target_w * aspect_ratio)
|
| 95 |
|
| 96 |
# Ensure dimensions are multiples of MOD_VALUE
|