Writing Prompt Generation with Python and Free AI-Generated Art

Create unique Writing Prompt Generation with Images using nothing but Python and AI-Generated Art Creation.

Read Time:4 Minute, 15 Second
Photo by Scott Graham on Unsplash

Recently I started writing again. However, I would write for thirty minutes and then get stuck. Writing is a habit, but sometimes I’m unsure whether I want my characters to turn right or left. I’ve always broken through writer’s block is by reinforcing the habit, so I turned to https://www.reddit.com/r/WritingPrompts/ for inspiration and to perform some writing prompt generation.

But wait! I have a Python Script that will pull the top posts from any subreddit, and I’m a visual person, so I should generate some images to go along with it. Since I’m still on the waitlist for Dall-E-2, I turned to Wombo’s Dream to generate some visuals. Now with visuals and prompts, I can produce writing prompts for myself, so I always have a tool to break through my writer’s block. 

All I need to do is:

  1. Get the prompts from Reddit
  2. Summarize the Prompts and Choose an art style
  3. Generate the images from Wombo’s Dream

Let’s get started. If you want to download the code, you can download the files in this GitHub repository.

Get the Prompts from Reddit

I’ll use Python and the PRAW package to extract the r/Writing prompts. Here’s the final code.

The first thing that you want to do is authenticate an application with Reddit. The instructions can be found here. We will need the clident_id and client_secret for the next step.  

This code will perform our writing prompt generation. We will create a tab-delimited file, so we don’t have to worry about commas in the prompts as we parse the file in the next step. This file will have the columns we will need to call the Wombo Art Generation Script: summary and style, a place for us to do some organization: genre, and columns to host the information from Reddit: Title, Url, id, and author. The script will pull the top 500 posts from the subreddit and write them to a file we will use later.

Time for your Input

Now that we have the file of our posts, we want to do two things, create a summary of the prompt that we can use to inspire us to write and choose a style from the options provided by the Wombo Dream app. You can see in the below screenshot a sample of what this should look like.

Sample Output from Reddit Augmented with my Summaries

Make sure you select only styles from the Dream Application; otherwise, the script will default to “no style.” I found that sometimes my summarization and art choice was excellent, and other times it wasn’t appealing. The AI is not making aesthetic decisions, so don’t be worried if the image isn’t exactly what you want; you can always try again.

I’ve created an Etsy store with some of my favorite images I have generated (you have the copyright to any images you create). For example, the image below was created with the prompt Grandma is a Twitter Influencer.

Grandma is a Twitter Influencer Journal
A Journal created by Wombo and Available on Etsy.

Creating the Artwork with Wombo

A couple of months ago, I wrote an article about journaling and how I used Wombo Dream to augment my daily journal.  

I wanted to automate more of my life, so I used Fiverr (affiliate link) to find someone to help me build automation using Selenium. The results of that gig is below:

 Between the original location, Wombo changed some of its elements on the main app, which resulted in me making some changes to the original code. This code worked as of June 2022. You may need to make adjustments as the Wombo app continues to evolve.

I then wrote a helper class to iterate over the TSV file we created in the previous step.

I could create 15 to 20 images in 30 minutes using these two python files, which was completely automated! Once I ran the files, I could work on other projects, create new prompts, or even write on the prompts I had already completed!

I also used ffmpeg from my command line to create a video of all the images I created.

Here’s the straightforward command:

How to Use this Code

The complete code is available in the GitHub repo here. Why should you use this code?

1) Perform some Writing Prompt Generation! Spend an hour or so creating 30 prompts for the month!

2) Use the parameters in the PRAW package subreddit module to get ideas about a certain topic. Here’s an example to add a search term to your python call.

or submission in Reddit.subreddit("writingprompts").search("Dragons")

3) Use the Wombo Generation Code to automate your journaling

The beauty of this code base and how its grouped allows you to use the individual components for whatever you need or want.

Previous post Creating a Home Automation Mood – Lights, Music, and Video
Next post You Need to Build Your own Personal Corpus before the Singularity