Skip to content

Commit 145c118

Browse files
add ability to accept jpgs
1 parent c8c862d commit 145c118

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

helper_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def process_image(image, dim=224):
2222
Returns:
2323
- Normalized Pytorch Tensor (image)
2424
"""
25-
# NOTE: Check ability to accept jpg images.
26-
if type(image) != Image.Image:
25+
26+
if isinstance(image, (np.ndarray)):
2727
im = Image.fromarray(image)
2828
else:
29-
im = Image.open(image)
30-
29+
im = Image.open(image)
30+
3131
# resize image
3232
width, height = im.size
3333
if width > height:

0 commit comments

Comments
 (0)