Ever seen a really stupid meme which is just a distorted image of something with it's name misspelled in Impact font on it, with a conspicuous lack of an actual joke, laughed at it, and thought about how humor had degraded so badly you wondered if you could automate it? Regretably, I didn't leave it to speculation.
The 2020s Humor Bot is a twitter bot, using my twitter library EasyTweeter and the power of ARTIFICIAL INTELLIGENCE to make really stupid images and upload them to twitter every two hours.
Give it a follow at @2020sHumorBot.
If you want to download it yourself or check out the code, check out it's github page.
Example Output Images
It's written in python, and it uses ImageAI and TensorFlow for artificially intelligent object detection, Pillow, OpenCV and numpy for image manipulation and meme labelling, and EasyTweeter (that one's mine) to interface with twitter.
Most of what the bot does is wrapped in libraries, so it ends up less complicated than you'd think. Every time it runs, it does a few steps:
- Pick an image at random out of a directory on your computer.
- Use the ImageAI library to detect what objects are in the image and where in the image they are.
- Use Pillow to distort the image around the location of the detected object.
- Using some hand-rolled name stupification algorithms, mangle the name of the object.
- Using Pillow, label the image with the stupified name in a recognizable meme font.
- Using EasyTweeter, upload the image to twitter.
The images all come from Pexels, a free stock image website which doesn't require attribution. Given that it posts frequently, I need alot of images to avoid having noticable repeats, so I wrote a downloader script, unimaginatively called PexelsDownloader, which is included with the project if you download it's source. It's a pretty straightforward command line utility which uses their API to search and download images.
The bot is available on pip (
pip install TwentyTwentiesHumorBot), and the binaries for windows and it's source are available on it's github page.
- 1.0 (released July 10, 2020): Initial release.
The code is distributed under the MIT license.
It requires the impact font (comes with windows), the AI model (available on the ImageAI's github), and input images to work, all of which I don't distribute with the bot because of legal concerns.
All of the images the bot uses come from Pexels, a free stock image website which doesn't require attribution.