The meme generator is a fun python 3 application, with this application we can generate a meme using:
- Command line
- Flask Application
The generated meme is made of:
- A random dog image
- A quote, the quote has
- Author
- Body
- Example: To be or not to be by Homer
- Meme generated sample
- Clone this project or fork it
- Install Pillow
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
- Install Python DOCX
pip install python-docx
- Install xpdfreader
- Install Flask
pip install -U Flask
- Start web server
python3 app.py
-
Access the application using the next url http://127.0.0.1:5000/ you will see a meme being generated and display in your browser. The meme is generated randomly, the meme engine will select an image, a quote, and the author randomly tou can pres F5 and every time a new meme will be generated.
-
We can generate a custom meme by accessing the next url http://127.0.0.1:5000/create a html page will ask you:
- A valid URL like this image
- The quote's body
- The quote's author
- when you click "create" a meme with the input provided will be displayed.
- To see command's help
python -m meme -h
usage: meme.py [-h] [--path PATH] [--body BODY] [--author AUTHOR]
Meme generator CLI Cool Tool
optional arguments:
-h, --help show this help message and exit
--path PATH Image path to load, if not provided a random image will be chose
--body BODY Quote's Body, If not provided a random quote will be chose.
--author AUTHOR Quote's Author, If not provided a random quote will be chose.
- Execute the next command to execute a command line program and generate your meme, the program will give you the path of meme generated.
python -m meme --body="A good quote..." --author="El Luigi"
./tmp/meme-maker-2021-04-01 01:06:59.613848.jpg
The application has the next modules
-
QEngine, this module has all the ingestors, an ingestor will extract quotes from PDF, text files, Docx files and CSV files. Every ingestor will implement the parse method.
-
MemeEngine will use
- all the ingestors to create the quotes
- Pillow library to load, add the text to the image and save the image to the disk
-
app.py is the web application and will use QEngine and MemeEngine to provide the web server to create the memes.
-
meme.py is the cli application and will use QEngine and MemeEngine to provide the web server to create the memes, we use argsparse module to create the optional arguments of the command.
- To execute tests
python -m unittest --verbose tests.QuoteEngineTests
pydocstyle QuoteEngine/QEngine.py