Spaces:
Runtime error
Runtime error
gchhablani
commited on
Commit
·
312f3f7
1
Parent(s):
56538f9
Fix if condition in img transform
Browse files
utils.py
CHANGED
@@ -28,7 +28,7 @@ class Transform(torch.nn.Module):
|
|
28 |
transform = Transform(224)
|
29 |
|
30 |
def get_transformed_image(image):
|
31 |
-
if image.shape[-1] == 3
|
32 |
image = image.transpose(2, 0, 1)
|
33 |
image = torch.tensor(image)
|
34 |
return transform(image).unsqueeze(0).permute(0, 2, 3, 1).numpy()
|
|
|
28 |
transform = Transform(224)
|
29 |
|
30 |
def get_transformed_image(image):
|
31 |
+
if isinstance(image, np.ndarray) and image.shape[-1] == 3:
|
32 |
image = image.transpose(2, 0, 1)
|
33 |
image = torch.tensor(image)
|
34 |
return transform(image).unsqueeze(0).permute(0, 2, 3, 1).numpy()
|