https://github.com/javi22020/charactergen
Tool to generate identity-consistent LoRA training data.
https://github.com/javi22020/charactergen
ai ai-model api black-forest-labs character character-generator consistent consistent-characters diffusion flux identity image-generation lora midjourney replicate replicate-api stable-diffusion synthetic-data text2image training
Last synced: 7 months ago
JSON representation
Tool to generate identity-consistent LoRA training data.
- Host: GitHub
- URL: https://github.com/javi22020/charactergen
- Owner: javi22020
- Created: 2025-06-03T14:32:24.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-06-11T13:08:42.000Z (10 months ago)
- Last Synced: 2025-06-17T06:01:53.796Z (9 months ago)
- Topics: ai, ai-model, api, black-forest-labs, character, character-generator, consistent, consistent-characters, diffusion, flux, identity, image-generation, lora, midjourney, replicate, replicate-api, stable-diffusion, synthetic-data, text2image, training
- Language: Python
- Homepage:
- Size: 381 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CharacterGen
CharacterGen is a tool designed to generate series of identity-consistent images based on an initial description, using the Black Forest Labs or Replicate APIs.
## Example
Original character description
Generated consistent character images
## Features
Under the hood, CharacterGen uses both Flux 1.1 Pro Ultra and Flux.1 Kontext to create several images keeping the same identity. This allows for quick data generation for character LoRA training or other purposes.
## Usage
First, you need to set up your API keys for Black Forest Labs or Replicate. You can do this by copying + renaming the `.env.example` file to `.env` and filling in your API keys.
After setting up your API keys, you can run the script to generate images.
You can change the default generation provider at any time from the **Settings**
menu of the application.
**Recommended**: double click the `CharacterGen.bat` file to run the script. This will automatically set up the environment and run the script.
> [!NOTE]
> Sometimes, Windows Defender may flag the script as a potential threat. If this happens, you can safely ignore the warning and allow the script to run.
**Manual**:If you prefer to run the script manually, follow these steps:
1. Create a virtual environment (optional but recommended):
```bash
python -m venv venv
```
Activate the virtual environment:
- On Windows:
```bash
venv\Scripts\activate
```
- On macOS/Linux:
```bash
source venv/bin/activate
```
2. Install the required dependencies:
```bash
pip install -r requirements.txt
```
3. Run the script:
```bash
python main.py
```
## Configuration
You can customize the generation process by changing the prompts and variables of the script.
### Prompts
The script uses three different prompts.
- Base Prompt: This is the prompt fed to the model to generate the base image. You can add anything you want to include in the character description.
Template: `prompts/base.md`
> [!NOTE]
> If you add new variables to the base prompt, make sure to add a `.txt` file with the variable name in the `prompts/selectable` directory. This is necessary for the script to recognize the new variable.
- Instruct Prompt: This is the prompt used to generate the secondary images following the base image identity. It is designed to keep the identity of the character while changing the context. Template: `prompts/instruct.md`
> [!NOTE]
> If you add new variables to the instruct prompt, make sure to add a `.txt` file with the variable name in the `prompts/random` directory. This is necessary for the script to recognize the new variable.
- Random Prompt: The same as the instruct prompt, but in a different tone. This is used to "pre-caption" the images, making them more suitable for training. Template: `prompts/random.md`
### Variables
Each variable file has the same structure, with each line representing a different value for the variable. The script will randomly select one of these values when generating the images.
## Contributing
If you want to contribute to CharacterGen, feel free to open a pull request or issue. Contributions are welcome!