How to generate your first Pokemon cards with AI

We can achieve cool things with AI, especially with GPT-3.5 and Midjourney, capable of producing impressive images in various styles. Imagine a scenario where a creative individual named Jack has developed a Python script enabling the generation of realistic-looking Pokemon cards that don’t exist in real life but are internally consistent in terms of evolutions.

Here’s how you can try it at home:

Step 1: Installing Python 3.10 (or higher)

Ensure Python 3.10 (or a newer version) is installed on your computer. You can check by typing the following command in your terminal:

python --version

If not installed, download it from the official Python website.

Step 2: Installing Dependencies

Download the Pokemon AI Card Generator Python script from GitHub:

git clone https://github.com/pixegami/pokemon-card-generator.git
cd pokemon-card-generator

Install dependencies by typing the following command in your terminal:

pip install -r requirements.txt

Step 3: Setting up the environment

Add your source folder path to the PYTHONPATH:

export PYTHONPATH=$PYTHONPATH:src

Step 4: Setting up OpenAI and Midjourney

If you want to use OpenAI (GPT-3.5) to generate names and descriptions, create an OpenAI account and get your API key. Add the API key in an .env file in the project root folder:

nano .env

Paste your API key:

OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

For Midjourney, create an account and join their Discord.

See also  Top 6 Font Identification Tools for the Web

Step 5: Generate Pokemon Cards

To generate Pokemon cards, open your terminal and type:

python src/generate.py

This generates one or more JSON files containing a series of cards for each element. You can specify the number of cards using the -n option.

This will generate one or more JSON files containing a series of cards (between 1 and 3 cards) for each element (fire, water, etc.). The rarity, creature type, and number of evolutions of cards will be random.

If you want to generate maps for a specific element, you can use the -e option (for example, to generate maps for the fire element):

python src/generate.py -n 10

You can also specify a specific type of Pokemon to generate using the –subject option (for example, to generate Pumpkin Pokemon cards):

python src/generate.py -e grass --subject pumpkin

Step 6: Generate Map Images with Midjourney

Copy the image prompt from each card in the JSON file to Midjourney. This will give you four different images. Choose the one you like and enlarge it.

Download the image, save it in the “images” folder in the “output” folder, and rename it to match the image file in the JSON file (e.g., 001_chippo.png).

Step 7: Generate the Final Rendering of the Maps

Run the following command in your terminal:

python src/render_cards.py

The final maps will be saved in the “renders” folder.

And there you go! You have now generated random Pokemon cards using AI with Python!

Rate this post

Mohamed SAKHRI

I am Mohamed SAKHRI, the creator and editor-in-chief of Tech To Geek, where I've demonstrated my passion for technology through extensive blogging. My expertise spans various operating systems, including Windows, Linux, macOS, and Android, with a focus on providing practical and valuable guides. Additionally, I delve into WordPress-related subjects. You can find more about me on my Linkedin!, Twitter!, Reddit

Leave a Comment