Open
Description
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();
Metadata
Assignees
Labels
No labels