Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,10 +51,11 @@ OBJECT_NAMES = ['enemies']
|
|
| 51 |
def detect_objects_in_image(image):
|
| 52 |
# Ensure image is a PIL Image
|
| 53 |
image = Image.fromarray(image)
|
|
|
|
| 54 |
if isinstance(image, torch.Tensor):
|
| 55 |
image = transforms.ToPILImage()(image) # Convert tensor to PIL image
|
| 56 |
|
| 57 |
-
if isinstance(
|
| 58 |
orig_w, orig_h = image.size # PIL image size returns (width, height)
|
| 59 |
else:
|
| 60 |
raise TypeError(f"Expected a PIL Image but got ")
|
|
|
|
| 51 |
def detect_objects_in_image(image):
|
| 52 |
# Ensure image is a PIL Image
|
| 53 |
image = Image.fromarray(image)
|
| 54 |
+
data = Image.fromarray(image)
|
| 55 |
if isinstance(image, torch.Tensor):
|
| 56 |
image = transforms.ToPILImage()(image) # Convert tensor to PIL image
|
| 57 |
|
| 58 |
+
if isinstance(image, Image.Image):
|
| 59 |
orig_w, orig_h = image.size # PIL image size returns (width, height)
|
| 60 |
else:
|
| 61 |
raise TypeError(f"Expected a PIL Image but got ")
|