Code Monkey home page Code Monkey logo

memegenerator's Introduction

Meme Generator:

This project has two parts

Quote Engine:

QuoteEngine is elegible to parse the Quote and the corrsponding Author from the pdf, csv, text and docx extention files. The module mainly builds on the Stratagy Object approachcreated with help of abstrctclass IngestorInterface. Any of the files as mentioned above can be paserd via parse(path: str) from sub-module Ingestor (QuoteEngine.Ingestor.parse(path)). The sub-module choose the appropriate module (PDFIngestor, CSVIngestor, TEXTIngetor & DOCXIngestor ) need to parse the provided file as input in parse(path) method and return list of QuoteModel QuoteModel objects. Each Object of the QuoteModel belongs two attributes quote & author.

Usages of QuoteEngine module:

Example: The example below is run from the /scr directory

In [4]: import QuoteEngine as Q                                                            

In [5]: path = './_data/DogQuotes/DogQuotesCSV.csv'                                        

In [6]: objs = Q.Ingestor.parse(path)                                                      

In [7]: objs[0].quote                                                                      
Out[7]: 'Chase the mailman'

In [8]: objs[0].author                                                                     
Out[8]: 'Skittle'

Dependencies:

Requirements:

1. [subprocess](https://docs.python.org/3/library/subprocess.html)
2. [python-docx](https://python-docx.readthedocs.io/en/latest/user/install.html)

System needs XpdfReader installed.

MemeEngine:

The MemeEngine is build up to work with picture, qoute and the auther of the quote. The general functionality of this module is to receive the picture, quote, and author and return picture with quote and author anchored on it. The module also allows to crop the given picture via the parameter width of make_meme() method.

Usaes of MemeEngine module:

Example: The example below is run from the /src directory


In [3]: import MemeEngine as m                                                             

In [4]: in_path = './_data/photos/dog/xander_2.jpg'                                        

In [6]: out_path = './test_meme.jpg'                                                       

In [7]: quote = 'United we stand, divided we fall.'                                        

In [8]: author = 'Aesop'                                                                   

In [10]: m.MemeEngine(out_path).make_meme(in_path=in_path, text=quote,  
    ...:                                  author=author, width=400) 
Out[10]: './test_meme.jpg'

imgur

To create meme randomly or on intended picture

Run the app from src directory.

python3 app

Then copy the link past it on the google browser. Some free figure links are here

  1. picturei1
  2. picture2

Dependencies

Requirements:

1. PIL: [pillow](https://pillow.readthedocs.io/en/stable/installation.html)
2. DOCX: [docx](https://python-docx.readthedocs.io/en/latest/user/install.html)
3. Xpdf:
	For Ubuntu:
	```
	$ wget http://security.ubuntu.com/ubuntu/pool/main/p/poppler/libpoppler73_0.62.0-2ubuntu2.12_amd64.deb
	  
	$ sudo apt-get install ./libpoppler73_0.62.0-2ubuntu2.12_amd64.deb
	$ wget http://archive.ubuntu.com/ubuntu/pool/universe/x/xpdf/xpdf_3.04-7_amd64.deb
	$ sudo apt-get install ./xpdf_3.04-7_amd64.deb
	```
	or 

follow here 4. Flask

Acknowledgement:

Udacity

memegenerator's People

Watchers

RubelMozumder 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.