Spaces:
Sleeping
Sleeping
Commit
·
b6dd888
1
Parent(s):
c138b4c
Modified resize image to pass image correctly
Browse files
app.py
CHANGED
@@ -436,10 +436,10 @@ def resize_image(image, scaling_factor=1):
|
|
436 |
def resize_to_square(image, size=1024):
|
437 |
|
438 |
# Load image if a file path is provided
|
439 |
-
if isinstance(
|
440 |
-
img = Image.open(
|
441 |
else:
|
442 |
-
img =
|
443 |
|
444 |
# Resize while maintaining aspect ratio
|
445 |
img.thumbnail((size, size), Image.LANCZOS)
|
|
|
436 |
def resize_to_square(image, size=1024):
|
437 |
|
438 |
# Load image if a file path is provided
|
439 |
+
if isinstance(image, str):
|
440 |
+
img = Image.open(image).convert("RGBA")
|
441 |
else:
|
442 |
+
img = image.convert("RGBA") # If already an Image object
|
443 |
|
444 |
# Resize while maintaining aspect ratio
|
445 |
img.thumbnail((size, size), Image.LANCZOS)
|