Spaces:
Paused
Paused
Update app_gradio.py
Browse files- app_gradio.py +1 -16
app_gradio.py
CHANGED
@@ -166,22 +166,7 @@ def generate_output(image, apply_filter, prompt: str, num_seeds: int = 3, lambda
|
|
166 |
# Save the input image temporarily
|
167 |
temp_image_path = os.path.join(exp_dir, "temp_input.png")
|
168 |
|
169 |
-
|
170 |
-
width, height = image.size
|
171 |
-
|
172 |
-
# Step 1: Make the image square if it's not already
|
173 |
-
if width != height:
|
174 |
-
# Use the smaller dimension to crop to a square
|
175 |
-
min_dim = min(width, height)
|
176 |
-
left = (width - min_dim) // 2
|
177 |
-
top = (height - min_dim) // 2
|
178 |
-
right = left + min_dim
|
179 |
-
bottom = top + min_dim
|
180 |
-
image = image.crop((left, top, right, bottom))
|
181 |
-
|
182 |
-
# Step 2: Resize to 256 if the image is larger
|
183 |
-
if image.size[0] > 256: # Image is square at this point
|
184 |
-
image = image.resize((256, 256), Image.LANCZOS)
|
185 |
|
186 |
image.save(temp_image_path)
|
187 |
|
|
|
166 |
# Save the input image temporarily
|
167 |
temp_image_path = os.path.join(exp_dir, "temp_input.png")
|
168 |
|
169 |
+
image = image.resize((512, 512), Image.LANCZOS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
image.save(temp_image_path)
|
172 |
|