Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -304,7 +304,25 @@ class RetroArtConverter:
|
|
| 304 |
original_width, original_height = input_image.size
|
| 305 |
target_width, target_height = self.calculate_optimal_size(original_width, original_height)
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
print(f"Resizing from {original_width}x{original_height} to {target_width}x{target_height}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
print(f"Prompt: {prompt}")
|
| 309 |
print(f"Img2Img Strength: {strength}")
|
| 310 |
|
|
|
|
| 304 |
original_width, original_height = input_image.size
|
| 305 |
target_width, target_height = self.calculate_optimal_size(original_width, original_height)
|
| 306 |
|
| 307 |
+
# --- FIX: Ensure values are Python int ---
|
| 308 |
+
# This is the fix. Even if calculate_optimal_size returns numpy.int64,
|
| 309 |
+
# this converts them to standard Python integers for PIL.
|
| 310 |
+
target_width = int(target_width)
|
| 311 |
+
target_height = int(target_height)
|
| 312 |
+
# --- END FIX ---
|
| 313 |
+
|
| 314 |
print(f"Resizing from {original_width}x{original_height} to {target_width}x{target_height}")
|
| 315 |
+
|
| 316 |
+
# Resize with high quality - ensure dimensions are Python ints
|
| 317 |
+
# You can now safely remove the redundant int() casts here if you want
|
| 318 |
+
resized_image = input_image.resize((target_width, target_height), Image.LANCZOS)
|
| 319 |
+
|
| 320 |
+
# Generate depth map using Zoe
|
| 321 |
+
print("Generating Zoe depth map...")
|
| 322 |
+
depth_image = self.get_depth_map(resized_image)
|
| 323 |
+
if depth_image.size != (target_width, target_height):
|
| 324 |
+
depth_image = depth_image.resize((target_width, target_height), Image.LANCZOS)
|
| 325 |
+
|
| 326 |
print(f"Prompt: {prompt}")
|
| 327 |
print(f"Img2Img Strength: {strength}")
|
| 328 |
|