This project is a Telegram bot that generates images using a flux model based on user prompts. It integrates with a local ComfyUI server to process image generation requests.
- Python 3.7+
- ComfyUI server running locally
- Telegram Bot Token
-
Clone the repository:
git clone https://github.com/yourusername/flux-generator-bot.git cd flux-generator-bot -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the project root and add your Telegram Bot Token:TELEGRAM_BOT=your_telegram_bot_token_here
-
Ensure your ComfyUI server is running on
127.0.0.1:8188.
-
Update the
AUTHORIZED_USERSlist influx_generator_bot.pywith the Telegram user IDs that are allowed to use the bot. -
Ensure the workflow JSON files (
workflow_api_flux_dev.json,workflow_api_flux_dev_lora.json, andworkflow_api_lora_Tami.json) are present in the project directory.
To start the bot, run:
python Comffi\ files/scripts/flux_generator_bot.py
- Start a chat with your bot on Telegram.
- Use the
/startcommand to initiate the bot. - Use the
/stepscommand followed by a number to set the number of steps for image generation (e.g.,/steps 20). - Send any text message to generate an image based on that prompt.
- Image generation based on text prompts
- Adjustable steps for image generation
- Authorization check for bot usage
- Support for different workflows (default, 'Y' for lora, 'T' for Tami lora)
flux_generator_bot.py: Main bot scriptwebsockets_api.py: Handles communication with the ComfyUI serverrequirements.txt: List of Python dependencies- Workflow JSON files: Define the image generation workflows
Please feel free to submit issues or pull requests if you have suggestions for improvements or find any bugs.
[Specify your license here]
This project uses the ComfyUI backend for image generation and the python-telegram-bot library for the Telegram bot functionality.