From 04d2d6ef55f8d7ed853d43a300c2404c193ea53a Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sat, 26 Jun 2021 23:26:57 -0600 Subject: [PATCH] Fix loop to account for accuracy --- jarvis/cogs/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jarvis/cogs/image.py b/jarvis/cogs/image.py index ec4a459..a37c8b8 100644 --- a/jarvis/cogs/image.py +++ b/jarvis/cogs/image.py @@ -69,7 +69,7 @@ class ImageCog(commands.Cog): accuracy = 0.0 # TODO: Optimize to not run multiple times - while len(file) > tgt_size: + while len(file) > tgt_size or accuracy < 0.50: old_file = file buffer = np.frombuffer(file, dtype=np.uint8) @@ -83,7 +83,7 @@ class ImageCog(commands.Cog): accuracy = (len(file) / tgt_size) * 100 if accuracy <= 0.50: file = old_file - ratio = ratio + 0.1 + ratio += 0.1 else: ratio = tgt_size / len(file) - 0.02