A powerful and user-friendly GUI application for generating images using the Replicate API and Flux LoRA models. Built with NiceGUI, this tool provides an intuitive interface for controlling various parameters of image generation, making it accessible for both beginners and advanced users.
- 🖼️ Image Generation: Generate images using the Replicate API and custom Flux LoRA models
- 💾 Flexible Output: Save generated images to a specified output folder or download through your browser
- 🖥️ Modern GUI: Clean, responsive web interface built with NiceGUI and dark mode support
- 🐳 Docker Support: Easy deployment with Docker and Docker Compose
- 📊 Model Management: Store and quickly switch between multiple Replicate models
- 🔄 Async Processing: Asynchronous image generation and download for better performance
- ⚙️ Advanced Parameters: Fine-tune generation with aspect ratio, inference steps, guidance scale, and more
- 🔧 Robust Architecture: Modular codebase with proper error handling and logging
- 📦 Modern Dependency Management: Support for both pip/venv and uv package manager
- 🔍 Code Quality: Linted with Ruff and follows Python best practices
Docker is the recommended way to run this application. Follow these steps to get started:
-
Ensure you have Docker and Docker Compose installed on your system.
-
Create a new directory for the project and navigate to it.
-
Create a
docker-compose.yml
file with the following content:services: replicate-flux-lora: image: ghcr.io/rtuszik/replicate-flux-lora:latest container_name: replicate-flux-lora ports: - "8080:8080" volumes: - replicate-flux-lora-settings:/app/settings - ${HOST_OUTPUT_DIR}:/app/output restart: unless-stopped volumes: replicate-flux-lora-settings:
-
Set the
HOST_OUTPUT_DIR
environment variable to the directory where you want to save generated images:export HOST_OUTPUT_DIR=/path/to/your/output/directory
Replace
/path/to/your/output/directory
with the actual path on your host machine. -
Run the application using Docker Compose:
docker-compose up -d
-
Access the application at
http://localhost:8080
For local development, you can run the application directly with Python. The project supports both traditional pip/venv and modern uv package manager.
-
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Clone the repository:
git clone https://github.com/rtuszik/replicate-flux-lora.git cd replicate-flux-lora
-
Install dependencies and run:
uv sync uv run python src/main.py
-
Clone the repository:
git clone https://github.com/rtuszik/replicate-flux-lora.git cd replicate-flux-lora
-
Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python3 src/main.py
-
Access the application at
http://localhost:8080
- Open the application in your web browser at
http://localhost:8080
. - Set up your Replicate API key in the settings (see API Key Setup).
- Add a Replicate LoRA model and select it from the dropdown.
- Adjust the generation parameters (Flux Model, Aspect Ratio, Number of Outputs, etc.).
- Enter your prompt in the text area at the bottom.
- Click "Generate Images" to start the generation process.
- View and download the generated images from the gallery on the right side of the interface.
In order to fine-tune you own model, please check out Replicate's guide on fine-tuning Flux: https://replicate.com/blog/fine-tune-flux
To use this application, you need a Replicate API key. Follow these steps to set it up:
- Sign up for an account at Replicate.
- Generate an API key in your account settings.
- In the application UI, click the settings icon in the top right corner.
- Enter your API key in the provided field and save the settings.
The API key will be stored and used for subsequent requests.
Contributions are welcome! Please feel free to submit a Pull Request.