FluxImageGenerationAgentSystem is a Python FLUX.1 text-to-image agent that orchestrates local diffusion generation for developers with NVIDIA GPUs.
It pairs Black Forest Labs' FLUX.1 diffusion models with an LLM agent that interprets requests, crafts prompts, and orchestrates the image pipeline through Hugging Face Diffusers and CUDA.
Note: an experiment from September 2024 exploring agentic image-generation systems (the text models have since been updated).
After installing Conda, create the environment and install the project dependencies:
conda create --name fluxgen python=3.12.4 -y
conda activate fluxgen
pip install --no-cache-dir -r requirements.txtConfigure OPENAI_API_KEY, install a compatible NVIDIA driver and CUDA
toolkit, request access to the gated FLUX.1-dev model, then run python3 main.py.
For a single test generation, run the agent once and list the saved PNG result:
python3 main.py --count 1
find output -type f -name '*.png' -print- Agent-driven prompting — an LLM agent turns natural-language requests into optimized FLUX prompts (capped for concise, focused generations).
- FLUX.1-dev image generation — local inference through Hugging Face Diffusers with GPU acceleration.
- Tool-using agent architecture — modular agent factory, tools, memory management, and inference pipeline.
- Automatic output management — generated images are saved and organized on disk.
config/— configuration modules:image_config.py,image_models_config.py, andprogram_config.py.scripts/— core system:AgentFactory.py/AgentSystemInitiator.py(agent setup),ModelFactory.py/InferencePipeline.py(FLUX model loading and generation),ToolFunctions.py/FileTools.py(agent tools),MemoryManager.py(conversation memory), andImageSaver.py/OutputManager.py(saving output).main.py— application entry point.
- Quickstart
- FLUX.1 Text-to-Image Agent Features
- Architecture
- Prerequisites
- Environment Setup
- Installation
- Model Access Configuration
- Running the FLUX.1 Text-to-Image Agent
Before getting started, ensure you have the following:
- Get your API key from OpenAI Platform
- Set up the
OPENAI_API_KEYenvironment variable
- Download and install CUDA 12.4.0 from NVIDIA Developer
- Ensure your system has compatible NVIDIA GPU drivers
- Download and install Miniconda from Anaconda
- This will be used to manage Python environments and dependencies
- Windows: Open the Anaconda Prompt terminal
- macOS/Linux: Use your terminal with conda configured
cd path/to/FluxImageGenerationAgentSystemconda create --name fluxgen python=3.12.4 -yconda activate fluxgenInstall all required dependencies using pip:
pip install --no-cache-dir -r requirements.txtTo use this model, follow these steps:
- Visit the FLUX.1-dev model page on Hugging Face
- Click the "Request Access" button (if available)
- Wait for approval from the model owner
- If you don't have an account, sign up here
- Log in to your Hugging Face account
- Go to your Hugging Face settings
- Click "New token" to generate a token (choose "Read" access)
- Copy the generated token
huggingface-cli loginPaste your token when prompted.
Once all setup steps are complete, start the application:
python3 main.pyNote: Make sure your system meets all hardware requirements for running FLUX models, including sufficient GPU memory and CUDA compatibility.
Set OPENAI_API_KEY in the active Conda environment. The application starts
with the image topic defined in config/image_config.py; --count N limits
the number of agent iterations, while omitting it keeps the loop running until
interrupted.
It generates images with the FLUX.1-dev diffusion model after an OpenAI-powered
agent turns the initial topic into a focused image prompt. The output manager
writes generated files under the ignored output/ directory.
Yes for the documented local FLUX workflow. The project is configured for CUDA inference and does not promise a CPU-only fallback.
The Hugging Face model is gated. Your account must be approved and authenticated
with huggingface-cli login before Diffusers can download the model weights.
Run python3 main.py after the API key, CUDA environment, and model access are
configured. Add --count 1 to run one iteration and exit.
No. It is an independent experiment that combines an LLM prompt agent with a local FLUX.1 Diffusers pipeline; the official model repositories remain the authoritative source for model weights and licensing.
Document hardware or dependency assumptions with reproducible commands, keep API keys out of commits, and include a short validation note with changes. Because generation requires a gated model and CUDA hardware, contributors should state when a check could only be performed by inspection.
See LICENSE.md for the repository's license and third-party model terms.