Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
@@ -271,14 +271,14 @@ class StateManager:
|
|
271 |
"""
|
272 |
|
273 |
img = copy.deepcopy(image_input)
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
|
283 |
if new_width is not None and new_height is None:
|
284 |
# Calculate new height to maintain aspect ratio
|
|
|
271 |
"""
|
272 |
|
273 |
img = copy.deepcopy(image_input)
|
274 |
+
if isinstance(img, str):
|
275 |
+
# Open the image from a file path
|
276 |
+
image = Image.open(img)
|
277 |
+
elif isinstance(img, Image.Image):
|
278 |
+
# Use the image directly if it's already a PIL Image object
|
279 |
+
image = img
|
280 |
+
else:
|
281 |
+
raise ValueError("image_input must be a file path or a PIL Image object")
|
282 |
|
283 |
if new_width is not None and new_height is None:
|
284 |
# Calculate new height to maintain aspect ratio
|