AI, particularly GPT-3.5 and Midjourney, enable us to create fascinating outputs. For instance, Jack, an enthusiast, has created a Python script that can generate remarkably realistic Pokémon cards that don’t exist in reality. This script even ensures that the evolutions of the Pokémon are consistent with one another. Additionally, Midjourney can produce stunning images in any style desired.

The project is free and available on Github and here’s how to do it at home.
Step 1: Install Python 3.10 (or higher)
Make sure you have Python 3.10 (or newer version) installed on your computer ^^. You can check if Python is already installed by typing the following command in your terminal:
python --version
If you don’t have Python, you can download it from the official Python website .
Step 2: Installing dependencies
Download the Pokemon AI map generator Python script from GitHub like this:
git clone https://github.com/pixegami/pokemon-card-generator.git
And go to the folder:
cd pokemon-card-generator
Then install the dependencies by typing the following command in your terminal:
pip install -r requirements.txt
Step 3: Setting up the environment
Add the path of your source folder to the PYTHONPATH by typing the following command in your bash terminal:
export PYTHONPATH=$PYTHONPATH:src
Step 4: Configure OpenAI and Midjourney
If you want to use OpenAI (GPT-3.5) to generate names and descriptions, you need to create an OpenAI account and retrieve your API key.
Then you can add your API key in an .env file in the project root folder.
nano .env
And paste this in there:
OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
To use Midjourney to generate map images, you also need to create an account and join their Discord.
Step 5: Generate Pokemon Cards
Then, to generate Pokemon cards, open your terminal and type the following command:
python src/generate.py

This will generate one or more JSON files containing a series of maps (between 1 and 3 maps) for each element (fire, water…etc). The rarity, creature type, and number of card evolutions 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
Inside the JSON file, there is a prompt that instructs how to create an image suitable for Midjourney, along with the corresponding file name. You can extract the image prompt for each card in the Midjourney bot and evaluate if it can be automated. Once you have done this for all four cards, you will have four distinct images to choose from. Select the one that appeals to you the most and enlarge it.

Firstly, retrieve the image and store it in the “images” directory within the “output” folder. Remember to rename the image to correspond with the image file indicated in the JSON file (such as 001_chippo.png).
In the event that Midjourney is unavailable, Stable Diffusion can also be utilized. With some practice, comparable outcomes to NickOlas can be attained.
The proof :

Step 7: Generate the final rendering of the maps
By utilizing the “render_cards.py” script, you can now produce a PNG image representation of the cards. Any maps that you have created using Midjourney will be accurately finalized. To execute the script, simply enter the following command in your terminal:
python src/render_cards.py
The final maps will then be saved in the “renders” folder.
And There you go ! You have now generated random Pokemon cards using AI using Python!

It would be ideal to have Pokemon cards available in different languages through translation, which would be a great addition.