You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But it would be more efficient if we sorted by size and picked the smallest image to send to the detection API.
I've done this in JS (am working on a node version bc I don't know python) but in the meantime if someone wants to port this to python I think this would be an improvement:
Currently the bot is just picking out the zeroth element:
url = post['image_versions2']['candidates'][0]['url']
But it would be more efficient if we sorted by size and picked the smallest image to send to the detection API.
I've done this in JS (am working on a node version bc I don't know python) but in the meantime if someone wants to port this to python I think this would be an improvement:
const smallestImage = item.image_versions2.candidates.sort((a, b) => a.width * a.height > b.width * b.height).pop();
The text was updated successfully, but these errors were encountered: