Anyways, this does a few things:
As you can tell, I took this picture with text generated from an old model. I was orignially going to generate love poems with this, but I decided that Terry Pratchett was a better use of everyone's time.
The email is sent by running a program which calls a the different parts and
sends them to a function that builds the email.
First it makes a Terry Pratchett text snippet from the RCNN. I have 4 LSTM Layers,
with a 50% dropout after every epoch. It took about 51 epochs to start getting good
results - I want to train it for about 50 more, I'll probably work on that soon.
Because I'm training the model on AWS and wanted to monitor the model's progress, I added an email function. I train the model for a single epoch (loading the data in takes a significant minority of the training time), save the model and predict on some randomly pulled text from the training set. This text is then sent to my email so I can see it from my phone. I also get the epoch number the model is on.
It then pulls an image from Flickr. Flickr has an API that lets you pass tags to it and get images back. I'm going to be honest, I read just enough to get this working and there might be better ways to do this. I have the tags set to shuffle, but it always pulled the last one I had in my list (Border Collies fwiw), so I shuffle the list of tags everytime I call the flickr_scraper. I also wanted to make sure I sent original pictures. To do this I made a text file called "sent_images.txt" and save the Flickr picture name to this file. I then pull a picture and make sure it's name is not in the file.
Next I pass everything to the email function I built. This builds and sends an email using MIME and an opened Gmail account. I made this pretty flexible as I can see myself using a basic python emailer pretty regularly.
Overall I'm pretty happy with the results. I want to add something to my bash that will call the main.py script every day at, say, 12pm.
EDIT: It looks like schedule can do this well. I'll have to look into that more soon.