This Discord bot generates images from text prompts using the StableDiffusionXLPipeline
model from diffusers
. Users can customize various parameters to fine-tune the generated images.
- Generate two images from a text prompt
- Customize guidance scale, number of inference steps, and aspect ratio
- Option to specify a negative prompt
- Error handling for incorrect parameters
- Python 3.8 or higher
- Discord bot token
- Required Python packages (
diffusers
,torch
,discord.py
,PIL
)
-
Clone the repository:
git clone https://github.com/Damarcreative/Bot-Discord-Animagine.git cd Bot-Discord-Animagine
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up your Discord bot token as an environment variable:
export ANI_TOKEN=your_discord_bot_token # On Windows, use `set ANI_TOKEN=your_discord_bot_token`
To start the bot, run:
python bot.py
Generate two images based on the provided prompt.
-
Parameters:
--no {negative prompt}
: Set the negative prompt. Example:--no .
to disable the negative prompt. Default: "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name."--cfg {guidance scale}
: Set the guidance scale. Default: 7.5.--step {num inference steps}
: Set the number of inference steps. Default: 28.--ar {aspect ratio}
: Set the aspect ratio. Example:--ar 1:1
. Default: 896 x 1152.
-
Supported Aspect Ratios:
- 1:1: 1024 x 1024
- 2:3: 896 x 1152
- 3:2: 1152 x 896
- 3:4: 832 x 1216
- 4:3: 1216 x 832
- 16:9: 1536 x 864
- 9:16: 864 x 1536
Example usage:
/imagine A beautiful sunset over the mountains --cfg 8.0 --step 30 --ar 16:9
Show the help message with details on how to use the bot and the available parameters.
The bot will notify users if there are errors in the parameters or values provided in the prompt. Ensure that all parameters are used correctly according to the documentation.
Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.
This project is licensed under the MIT License. See the LICENSE file for details