Well, my GF’s tastes in memes are simple: she loves wholesome memes and, most importantly, she loves animals.
That’s why I created a fun little project that:
- Surfs the subreddit r/wholesomemes using the reddit API
- Downloads a few of the hottest memes in the contents folder
- Initializes a ResNet50 model that recognizes images containing any animal
- Sends them via mail to my GF (positively welcomed)
Final email (3 memes by default)
I’m using the praw library for downloading the memes, it requires a Reddit Bot enabled. Use this guide for creating one, it’s a quick process.
ResNet50
ResNet50 (more info here) is an Image Recognition model that outputs a probability score (which I’m ignoring at the moment) and one of the 1000 labels available. The labels are mapped in the imagenet_class_index, and the first 397 are about animals (mostly cats and dogs). So, if the model’s predicted label is in that sublist, we can classify the meme as “containing animals”.
I’m using smtplib for sending the email, so it just requires the email and password of the sender and the email of the receiver.
Code
Source code here