Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -452,8 +452,9 @@ def predict(
|
|
| 452 |
# Apply sharpness enhancement.
|
| 453 |
if isinstance(image, np.ndarray):
|
| 454 |
pil_image = Image.fromarray(image)
|
| 455 |
-
enhanced_image = ImageEnhance.Sharpness(pil_image).enhance(
|
| 456 |
-
|
|
|
|
| 457 |
|
| 458 |
# ---------------------
|
| 459 |
# 1) Detect the drawer with YOLOWorld
|
|
@@ -529,7 +530,7 @@ def predict(
|
|
| 529 |
boundary_width_in = boundary_width
|
| 530 |
|
| 531 |
# Basic check so user doesn't request an impossible boundary
|
| 532 |
-
if boundary_length_in > (image_height_in -
|
| 533 |
raise BoundaryExceedsError(
|
| 534 |
"Error: The specified boundary dimensions exceed the allowed image dimensions. Please enter smaller values."
|
| 535 |
)
|
|
|
|
| 452 |
# Apply sharpness enhancement.
|
| 453 |
if isinstance(image, np.ndarray):
|
| 454 |
pil_image = Image.fromarray(image)
|
| 455 |
+
enhanced_image = ImageEnhance.Sharpness(pil_image).enhance(1)
|
| 456 |
+
ei = ImageEnhance.Contrast(image).enhance(1.5)
|
| 457 |
+
image = np.array(ei)
|
| 458 |
|
| 459 |
# ---------------------
|
| 460 |
# 1) Detect the drawer with YOLOWorld
|
|
|
|
| 530 |
boundary_width_in = boundary_width
|
| 531 |
|
| 532 |
# Basic check so user doesn't request an impossible boundary
|
| 533 |
+
if boundary_length_in > (image_height_in - 1) or boundary_width_in > (image_width_in - 1):
|
| 534 |
raise BoundaryExceedsError(
|
| 535 |
"Error: The specified boundary dimensions exceed the allowed image dimensions. Please enter smaller values."
|
| 536 |
)
|