Skip to main content

TwentyTwentiesHumorBot is a bot which takes images, makes them stupid with the power of AI, and then posts them to twitter.

Project description

2020s Humor Bot

2020s Humor Bot is a python based twitter bot which takes a random image out of a folder, makes it stupid, and posts it to twitter.

Visit the bot on twitter at @2020sHumorBot!

When it runs, the ImageAI library is used to identify what is in the image, a hand-built stupification algorithm is applied to the name of the object, the image is distorted at the location of the object, the stupified name of the object is placed on the image in a recognizable meme font, and finally, the image is tweeted via the EasyTweeter library.

Examples

Below are some examples of it's output, pretty well covering the gamut of humor, quality, and stupidity.

distorted image of a person biking, labelled 'shpeed' distorted image of a keyboard, labelled 'shcishshorsh' distorted image of a cat, labelled 'doooog' distorted image of a dog, labelled 'wet' distorted image of a puppy being petted, labelled 'coouch' distorted image of a person, labelled 'person' distorted image of a plant, labelled 'bobbed blanb' distorted image of a cat, labelled 'cat' distorted image of a cat, labelled 'cta' distorted image of a cat, labelled 'cat' distorted image of a sleeping cat, labelled 'bed'

Installing the Bot

If you want to spin up a competing twitter account of your own with the bot, it can be installed and run a couple of ways.

Pip

If you have python 3 installed, pip is an easy way to acquire the bot, just run the following: pip install TwentyTwentiesHumorBot

Binary

If you don't have python installed, or don't want to use your python installation for whatever reason, you can download the binary for your OS of choice from the releases page, and run that like you would run a command line program as usual in that environment.

Because of the way Windows packages their EXEs, there's two versions, one which logs to stdout/stderr as usual, and one which doesn't (the _headless version), intended for running in the background via scheduled tasks.

Running from Source

Given that the bot is in python, running from source is easy if it's dependencies are available.

If you want to install the dependencies yourself, run pip install -r requirements.txt, and then setup.py install to install the bot itself.

Once dependencies are available, the TwentyTwentiesHumorBot package can be executed, since main.py is present.

Running the Bot

Because of potential licensing issues and file size constraints, a fair amount of data the bot needs can't (or shouldn't) be distributed with it.

Provide Data

Input images should be placed in the input directory inside the bot's home directory (see below for more on the location of this directory).

Any images can be used, but the canonical instance of the bot uses image downloaded from Pexels (via the downloader script in the PexelsDownloader folder), because the licensing of that website does not require attribution.

Provide a Model for ImageAI

As object detection is used to identify what kind of object is in the image, an AI model is required. It should be placed in the model directory within the bot's home directory. Only a single file should be placed there at a time.

The model is available in the ImageAI documentation.

Provide a Font

The impact font which is used to label the memes is installed with many modern operating systems, and it should be copied into the font directory inside the bot's home directory.

Provide Credentials

The file credentials.ini should be present in the bot's home directory, and it should contain the authentication information for twitter so the bot can post.

This file is in the format expected by EasyTweeter.

Running

Once the prerequisites are available, running the bot is as simple as running TwentyTwentiesHumorBot in your shell of choice.

Command Line Arguments

The following command line arguments are available (all optional):

  • --home-directory: provide a directory to override the default. If the directory does not exist, it will create it. Defaults to ~/.2020sHumorBot/
  • --log-level: override the default log level. Accepts: NOT_SET, DEBUG, INFO, WARNING, ERROR, CRITICAL. Defaults to INFO
  • --verbose (or -v): logs all output to stdout, in addition to log files (this is the default). Mutually exclusive with --quiet.
  • --quiet (or -q): disables all logging to stdout/stderr. All logging to the log files will be unaffected. Mutually exclusive with --verbose.
  • --curation (or -c): Runs all of the images in the home_dir/curation/input through the bot so you can see the output, without making any posts to twitter. Useful for ensuring the images you're giving the bot will work and be high quality.
  • --include-curation (or -ic): will run one full execution of the bot as usual, and then the curation explained above.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TwentyTwentiesHumorBot-1.0.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

TwentyTwentiesHumorBot-1.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file TwentyTwentiesHumorBot-1.0.0.tar.gz.

File metadata

  • Download URL: TwentyTwentiesHumorBot-1.0.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for TwentyTwentiesHumorBot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 061540f6eb35734487f52709eed294141c2d8def9122ac041a2880c0fb8e0cd8
MD5 4c8b097d4a645985611927757076462b
BLAKE2b-256 962a6509c25d1dba86550ee6dbacb956fcf764d4231757d45d1c052c8709bccb

See more details on using hashes here.

File details

Details for the file TwentyTwentiesHumorBot-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: TwentyTwentiesHumorBot-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for TwentyTwentiesHumorBot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f697722a3e7466c2b7b812ed1304d8aa0041d1071aa3998ee79996e3403fd912
MD5 35aa4cd48c7eb539d6bfd8b85d9c219d
BLAKE2b-256 142828ab7ef331193e0dd86a50af93da5d098b46da4d69daaa55034750ce348e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page