Fix loop to account for accuracy
This commit is contained in:
parent
2c4cefd1f8
commit
04d2d6ef55
1 changed files with 2 additions and 2 deletions
|
@ -69,7 +69,7 @@ class ImageCog(commands.Cog):
|
||||||
|
|
||||||
accuracy = 0.0
|
accuracy = 0.0
|
||||||
# TODO: Optimize to not run multiple times
|
# TODO: Optimize to not run multiple times
|
||||||
while len(file) > tgt_size:
|
while len(file) > tgt_size or accuracy < 0.50:
|
||||||
old_file = file
|
old_file = file
|
||||||
|
|
||||||
buffer = np.frombuffer(file, dtype=np.uint8)
|
buffer = np.frombuffer(file, dtype=np.uint8)
|
||||||
|
@ -83,7 +83,7 @@ class ImageCog(commands.Cog):
|
||||||
accuracy = (len(file) / tgt_size) * 100
|
accuracy = (len(file) / tgt_size) * 100
|
||||||
if accuracy <= 0.50:
|
if accuracy <= 0.50:
|
||||||
file = old_file
|
file = old_file
|
||||||
ratio = ratio + 0.1
|
ratio += 0.1
|
||||||
else:
|
else:
|
||||||
ratio = tgt_size / len(file) - 0.02
|
ratio = tgt_size / len(file) - 0.02
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue