Face to Face
Finally, I've found at least one actual use for an AI-powered tool. Even if this particular use case is absolutely not a new one.
On TrendingOnWiki - a website monitoring trending topics on Wikipedia - I use images took from Commons to enhance pages. Usually photos of people. In all possible orientations, and resolutions, and poses. But the slots where to display those images are fixed (as fixed are the previews of pages linked by the Twitter and the Mastodon accounts), and it happened quite often to cut faces on the top or on the bottom.
Then, I had the epiphany: use face detection to properly crop and resize images to use in my layouts.
There are a few "face detection" PHP packages on Packagist: most of them are just clients for online (and commercial) services, most of the others are all forks of the same GPL-licensed piece of code illegally redistributed with MIT license. On the other side there is abundancy of Python tools to accomplish that same task, so the most fast and dirty thing to do was to write a PHP wrapper around one of them.
Here is my own implementation, built on top of "face-recognition", a popular Python tool installable by pipx and providing a CLI to be brutally called with shell_exec
.
Now I have to re-process all the images already saved in my local caches to fix them...