Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Sep 14, 2021
1 parent 13c9618 commit 0b71c31
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ml4a/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def url_to_image(url):
img = Image.open(BytesIO(response.content))
finished = True
except:
time.sleep(5)
time.sleep(3)
n_tries += 1
finished = n_tries >= 10
finished = n_tries >= max_tries
return img


Expand Down Expand Up @@ -104,10 +104,9 @@ def resize(img, new_size, mode=None, align_corners=True):
resample_mode = sampling_modes[mode]
return img.resize((w2, h2), resample=resample_mode)


def get_size(img):
if isinstance(img, str):
image = load_image(image, 1024)
img = load_image(img)
w, h = img.size
elif isinstance(img, Image.Image):
w, h = img.size
Expand Down Expand Up @@ -275,7 +274,7 @@ def get_frame(self, frame_idx, size=None):
img = self.video.get_frame(time)
img = Image.fromarray(img)
if size is not None:
img = resize(img)
img = resize(img, size)
return img


0 comments on commit 0b71c31

Please sign in to comment.