Skip to content

AdmTal/emoji-puzzles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emoji Puzzles

👋 Welcome!

I used this repository to make my book Emoji Puzzles, now available on Amazon in ebook and paperback.

Here, you can access the tools I used to have AI generate both the puzzles and the code that converted them into the final manuscripts.

Feel free to use this as a resource for creating your own books! 😊

Looking forward to connecting with you and exploring more ways to apply AI in our lives! 💡

https://emojipuzzlebook.com/

How to Generate an Emoji Puzzle Book

Before starting, take a look at the example ebook and paperback. This is the final output you'll be working towards.

This project is written in Python, but don't worry, you won't need to know Python to use it.

To follow these instructions, you'll need to be familiar with your computer's Command Line Interface. If you're completely new to this, here's a beginner-friendly guide that can help you learn the basics.

Setup & Install Dependencies

First, download this repo, here's a good guide to get up to speed on git.

git clone https://github.com/AdmTal/emoji-puzzles.git
cd emoji-puzzles

This repo has emoji-data installed as a submodule.

You will need to download that in order to be able to generate emoji puzzle books.

This downloads ~4GB of emoji files, so it might take a little while 😅.

git submodule update --init

Then, install the required Python dependencies.

python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Generate an Emoji Puzzle Book

Run these commands. They each generate and then open a PDF file.

python src/generate_book.py --layout ebook
python src/generate_book.py --layout paperback

The generate_book.py script picks the latest set of puzzle files, and converts them into a book.

The repo comes preloaded with 2 movies, 2 TV shows, and 2 books, and that's why you see that content in the books you just generated.

How to Choose Your Own Movies, TV Shows, and Books

Interested in making emoji puzzles for your own favorite Movies, TV Shows, and Books?

Each puzzle is defined in a JSON file. Take a look at the file example for The Very Hungry Catapillar.

To create a puzzle, simply create a puzzle file for it and place in one of the puzzle folders

You can ✍️ write these files yourself, or you can use AI 🤖.

Generate Puzzles on Poe

If you sign up on poe.com, you can access my chatbot which is already "prompt engineered" to generate valid puzzle files.

All you'll need to do is give it a title.

How to Prompt the AI

This is the main prompt I used for this project.

Try copying and pasting that into ChatGPT (or any other currently available AI you want to try).

On this project, I used a mix of ChatGPT, OpenAI's Playground, and OpenAI's API.

The next section covers how to use the latter to generate puzzles in bulk.

Generating Puzzles with GPT-4

You'll need access to OpenAI's REST API to generate puzzles.

Sign up for an account at https://openai.com/.

Follow their documentation to provision your own API credentials.

Heads up, OpenAI charges for API usage, so make sure you go to your Settings to keep tabs on how much you are spending. I recommend you set up a hard limit under billing settings to avoid any surprises.

Save your API credentials into OS Environment Variables and run the generation script:

export OPENAI_API_ORG=add-your-org-id-here
export OPENAI_API_KEY=add-your-api-secret-key-here
python src/generate_emoji_puzzles.py

The generate_emoji_puzzles script will create emoji puzzles for the titles listed in the inputs folder.

That folder is filled with CSV files. You can simply add or remove titles and rerun the above generation script.

You can then rerun the generate_book script. That file always uses your latest generated files unless you specify the input path like so:

python src/generate_book.py --layout ebook --input 2023-03-29-06-37-AM

Fixing Errors

GPT-4 is pretty smart, but it might still generate invalid JSON from time to time.

Run this command to double-check that all puzzle files are formatted correctly:

python src/validate_puzzle_files.py

That script will let you know if any of the JSON objects are invalid, or missing required keys.

For example, sometimes GPT-4 might use "release-years": "1986-1990" instead of the required format "release_year": "1986".

I recommend fixing these errors manually. Copy and paste the file contents into this online JSON validator, and keep running the above script until the puzzles are error free.

Editing and Revising the Generated Emoji Puzzles

GPT-4 does an impressive job at generating emoji puzzles, but it's not perfect. Sometimes, you might find that the generated emojis aren't quite hitting the mark or that they contain incorrect details about the movie, TV show, or book. In such cases, you can use the following addendum to your prompt to request iterative improvements from the AI:

The user might respond with feedback asking for iterative improvements. Take their feedback into account, and send back updated EMOJI only. When the user confirms they are happy, then you can respond with the full JSON for that final set of EMOJI.

This will let you interact with GPT-4 (or another AI model) to ask for edits and revisions to the generated emoji puzzles. Once you're satisfied with the updated emoji set, you can then receive the final JSON and update your puzzle file. This process ensures that your emoji puzzles are as accurate and engaging as possible.

Releases

No releases published

Packages

No packages published

Languages