Giter VIP home page Giter VIP logo

meme-generator's Introduction

Overview

Meme Generator

The Meme Generator is a Python application that allows users to generate memes .

The application takes an image, a quote body, and an author name as inputs, and generates a new image with the quote overlaid on top.

Dependencies

The Meme Generator requires the following dependencies:

  • Python 3.6 or later

  • pandas

  • python-docx

  • Flask

  • Pillow

  • requests

You can install these dependencies using pip:

pip install pandas  python-docx Flask Pillow requests

Installation

To install the Meme Generator, clone the repository to your local machine:

git clone https://github.com/sureshvenkatesan/meme-generator.git

Then, navigate to the repository directory and install the dependencies:

cd meme-generator
pip install -r requirements.txt

Usage

To use the Meme Generator, run the app.py script as:

a)

python app.py

This will start the Flask application on http://localhost:5000. You can then access the application in your web browser by navigating to that URL.

By default the application will render a random meme image with a quote ( along with the author) overlayed on top. You will see 2 options "Random" and "Creator".

If you click on "Random" it will generate a new random meme. If you click on "Creator" you can specify an image url and enter a quote body and author name. Once you submit the form, the application will generate a new meme image ( for the specified image) with the quote overlaid on top and display it on the page.

or

b)

export FLASK_APP=app.py
flask run --host 0.0.0.0 --port 3000 --reload

This will start the Flask application on http://localhost:3000. You can then access the application in your web browser by navigating to that URL.

This application uses the following packages :

QuoteEngine

This has python modules to ingest files in different file formats like :

  • csv using CSVIngestor class that depends on pandas library
  • docx using DocxIngestor class that uses python-docx library
  • pdf using PDFIngestor class that utilizes the subprocess module to call the pdftotext CLI utility
  • txt using TextIngestor class.

These input files contain quote(s) and their authors . The QuoteEngine implements a Strategy pattern to ingest any of these file types and return a list of QuoteModel objects. QuoteModel represent a quote with a body and author.

Common file exceptions are handled and human-readable error messages are displayed.

The "tests" folders has some python programs that can be run from commandline to test the QuoteModel and Ingestor .

cd tests
python test.py
python testdoctypes.py

To become familiar with how to do relative import of Modules from another package ( and modify the Python Search path) please refer to :

MemeGenerator

This module creates a meme with specified dimensions by adding text and author to an image .

It can be tested using the meme.py a python program that can run from commandline takes three OPTIONAL arguments:

  • A string quote body
  • A string quote author
  • An image path

Common file exceptions are handled and human-readable error messages are displayed.

example usage:

python meme.py --body "This is a quote" --author "Author Name"
python meme.py --path "/meme-generator/_data/photos/dog/xander_4.jpg"
python meme.py --path "/meme-generator/_data/photos/dog/xander_4.jpg" --body "to be or not to be" --author "shakespeare"

After the meme is created it returns the path to the meme image.

meme-generator's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.