Update README.md in Meme_Generator
This commit is contained in:
+59
-27
@@ -1,50 +1,82 @@
|
||||
## Meme Generator Project
|
||||
## Meme Generator
|
||||
|
||||
### Overview
|
||||
The goal of this project is to build a "meme generator" – a multimedia application to dynamically generate memes, including an image with an overlaid quote.
|
||||
A Python application that combines an image with a quote to create a meme. It supports random or custom memes through a command-line interface and a small Flask web app.
|
||||
|
||||
### Features
|
||||
|
||||
### Set up environment
|
||||
```sh
|
||||
$ sudo apt-get install -y xpdf
|
||||
$ pip install -r requirements.txt
|
||||
- Import quotes from CSV, DOCX, PDF, and TXT files.
|
||||
- Resize images and overlay a quote and author.
|
||||
- Generate memes from bundled assets or user input.
|
||||
- Use either the command line or a browser interface.
|
||||
|
||||
### Requirements
|
||||
|
||||
- Python 3
|
||||
- Python packages in [`requirements.txt`](requirements.txt)
|
||||
- Poppler's `pdftotext` command on `PATH` for PDF quote ingestion
|
||||
|
||||
### Setup
|
||||
|
||||
Run these commands from this project directory:
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y xpdf
|
||||
sudo apt install python3-venv
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Run program
|
||||
### Command Line
|
||||
|
||||
Generate a meme from a random bundled image and quote:
|
||||
|
||||
Python test \
|
||||
Usage: `python3 meme.py --path [image_path] --body [quote_body] --author [quote_author]`
|
||||
```sh
|
||||
$ mkdir tmp
|
||||
$ python3 meme.py
|
||||
|
||||
```bash
|
||||
mkdir -p tmp
|
||||
python3 meme.py
|
||||
|
||||
python3 meme.py \
|
||||
--path ./_data/photos/dog/xander_1.jpg \
|
||||
--body "Stay pawsitive." \
|
||||
--author "Unknown"
|
||||
```
|
||||
|
||||
Flask test
|
||||
```sh
|
||||
$ mkdir static
|
||||
$ python3 app.py
|
||||
### Web App
|
||||
|
||||
```bash
|
||||
mkdir -p static
|
||||
python3 app.py
|
||||
```
|
||||
Open link `http://127.0.0.1:5000` in web browser
|
||||
|
||||
### Primary modules
|
||||
Open [http://127.0.0.1:5000](http://127.0.0.1:5000) for a random meme or use the `/create` page to submit an image URL and quote. Generated web images are saved in `static/`.
|
||||
|
||||
`QuoteEngine`: Meme engine module for handling the generation of meme images.\
|
||||
`MemeEngine`: QuoteModel module for representing a quote with its body and author.
|
||||
<a href="url"><img src="./images/random.png" width="500"></a>
|
||||
|
||||
### Sub modules
|
||||
<a href="url"><img src="./images/creator.png" width="500"></a>
|
||||
|
||||
`CSVIngestor`: Module for ingesting CSV files containing quotes. \
|
||||
`DocxIngestor`: Module for ingesting Docx files containing quotes. \
|
||||
`TextIngestor`: Module for ingesting text files containing quotes. \
|
||||
`PDFIngestor`: Module for ingesting PDF files containing quotes.
|
||||
### Project Structure
|
||||
|
||||
- [`meme.py`](meme.py) — Command-line entry point for generating random or custom memes.
|
||||
- [`app.py`](app.py) — Flask web application for creating memes in a browser.
|
||||
- [`MemeEngine/`](MemeEngine/) — Resizes images, positions quote text, and saves generated memes.
|
||||
- [`QuoteEngine/`](QuoteEngine/) — Represents quotes and imports them from supported file formats.
|
||||
- `QuoteModel` — Stores a quote's body and author.
|
||||
- `Ingestor` — Selects the appropriate file-format parser.
|
||||
- `CSVIngestor` — Imports quotes from CSV files.
|
||||
- `DocxIngestor` — Imports quotes from DOCX files.
|
||||
- `PDFIngestor` — Imports quotes from PDF files.
|
||||
- `TextIngestor` — Imports quotes from TXT files.
|
||||
- [`templates/`](templates/) — HTML templates used by the Flask application.
|
||||
- [`_data/`](_data/) — Sample images, quotes, and font assets.
|
||||
|
||||
### Format checking
|
||||
```sh
|
||||
```bash
|
||||
$ pip install docformatter
|
||||
$ pip install autopep8
|
||||
$ pip install black
|
||||
$ pip install flake8
|
||||
|
||||
$ docformatter -i -r --wrap-summaries 79 --wrap-descriptions 79 .
|
||||
$ autopep8 --in-place --recursive --aggressive .
|
||||
$ black .
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 241 KiB |
@@ -20,7 +20,7 @@ def generate_meme(path=None, body=None, author=None):
|
||||
|
||||
img = random.choice(imgs)
|
||||
else:
|
||||
img = path[0]
|
||||
img = path
|
||||
|
||||
if body is None:
|
||||
quote_files = [
|
||||
|
||||
Reference in New Issue
Block a user