diff --git a/.gitignore b/.gitignore index 8d1c113..dcb0396 100644 --- a/.gitignore +++ b/.gitignore @@ -154,12 +154,9 @@ dmypy.json # Cython debug symbols cython_debug/ -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ settings.json settings.local.toml .secrets.toml + +settings.local.toml +settings.toml diff --git a/Dockerfile b/Dockerfile index 8740ef4..2798b3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN python -m pip install -r requirements.txt # Copy the application source code to the working directory COPY src/ . +COPY settings.toml . # Expose the desired port EXPOSE 8080 diff --git a/README.md b/README.md index 0eaf8fc..e96905a 100644 --- a/README.md +++ b/README.md @@ -1,97 +1,87 @@ ![Super-Linter](https://github.com/rtuszik/replicate-flux-lora/actions/workflows/super-linter.yml/badge.svg) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/rtuszik/replicate-flux-lora/docker-build-push.yml) +# Flux LoRA Image Generator 🚀 -# Flux Replicate GUI -A simple web interface for running Flux models using the Replicate API. Use it to generate images with custom LoRAs and fine-tuned Flux models. - -## What it does -- Runs Flux models via Replicate API -- Lets you use custom LoRAs and fine-tuned models -- Allows disabling the Safety Checker -- Saves your settings -- Shows generated images in a gallery - -## Screenshot -![Screenshot](assets/screenshot_1.png) - - -## Recommended Setup: Docker -Docker is the recommended way to run this application. It ensures consistent environment across different systems. - -### Prerequisites -- Docker and Docker Compose installed on your system -- Replicate API key - -### Docker Compose Setup -1. Create a `docker-compose.yml` file with the following content: -```yaml - services: - replicate-flux-lora: - image: ghcr.io/rtuszik/replicate-flux-lora:latest - container_name: replicate-flux-lora - env_file: .env - ports: - - "8080:8080" - volumes: - - ${HOST_OUTPUT_DIR}:/app/output - restart: unless-stopped -``` - -2. Create a `.env` file in the same directory with the following content: - ``` - REPLICATE_API_TOKEN=your_api_key_here - HOST_OUTPUT_DIR=/path/to/your/output/directory - ``` - Replace `your_api_key_here` with your actual Replicate API key and `/path/to/your/output/directory` with the directory on your host machine where you want to save generated images. +![Application Screenshot](assets/screenshot_1.png) + +A powerful and user-friendly GUI application for generating images using the Replicate API and Flux LoRA models. This tool provides an intuitive interface for controlling various parameters of image generation, making it accessible for both beginners and advanced users. + +## Features + +- 🖼️ Generate images using the Replicate API and custom Flux LoRA models +- 💾 Save generated images to a specified output folder +- 🔑 Secure API key management through the UI +- 🖥️ User-friendly GUI +- 🐳 Docker support for easy deployment +- 📊 Model management for adding and removing Replicate models +- 🔄 Asynchronous image generation and download + +## Installation + +Docker is the recommended way to run this application. Follow these steps to get started: + +1. Ensure you have Docker and Docker Compose installed on your system. -### Running with Docker -1. Start the application: +2. Create a new directory for the project and navigate to it. + +3. Create a `docker-compose.yml` file with the following content: + + ```yaml + services: + replicate-flux-lora: + image: ghcr.io/rtuszik/replicate-flux-lora:latest + container_name: replicate-flux-lora + ports: + - "8080:8080" + volumes: + - ${HOST_OUTPUT_DIR}:/app/output + restart: unless-stopped ``` + +4. Replace `/path/to/your/output/directory` with the actual path where you want to save the generated images on your host machine. + +5. Run the application using Docker Compose: + + ```bash docker-compose up -d ``` -2. Open `http://localhost:8080` in your browser +6. Access the application at `http://localhost:8080` -3. Choose a model, set your options, enter a prompt, and generate images +## Usage -## Alternative Setup: Local Python Environment -If you prefer to run the application without Docker, you can use a local Python environment. +1. Open the application in your web browser at `http://localhost:8080`. +2. Set up your Replicate API key in the settings (see [API Key Setup](#api-key-setup)). +3. Add a Replicate LoRA model and select it from the dropdown. +4. Adjust the generation parameters (Flux Model, Aspect Ratio, Number of Outputs, etc.). +5. Enter your prompt in the text area at the bottom. +6. Click "Generate Images" to start the generation process. +7. View and download the generated images from the gallery on the right side of the interface. -1. Clone the repo: - ``` - git clone https://github.com/rtuszik/replicate-flux-lora.git - cd replicate-flux-lora - ``` +## Fine-Tuning -2. Create and activate a virtual environment: - ``` - python -m venv venv - source venv/bin/activate # On Windows, use `venv\Scripts\activate` - ``` +In order to fine-tune you own model, please check out Replicate's guide on fine-tuning Flux: + -3. Install dependencies: - ``` - pip install -r requirements.txt - ``` +## API Key Setup -4. Set up your environment variables: - - Copy the example.env file to create your own .env file: - ``` - cp example.env .env - ``` - - Edit the .env file and replace 'your_api_key_here' with your actual Replicate API key: - ``` - REPLICATE_API_TOKEN=your_api_key_here - ``` +To use this application, you need a Replicate API key. Follow these steps to set it up: -5. Run the application: - ``` - python main.py - ``` +1. Sign up for an account at [Replicate](https://replicate.com/). +2. Generate an API key in your account settings. +3. In the application UI, click the settings icon in the top right corner. +4. Enter your API key in the provided field and save the settings. + +The API key will be stored and used for subsequent requests. + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. + +## License + +[GPLv3](LICENSE) -6. Open `http://localhost:8080` in your browser +--- -## Need help? -Check out Replicate's guide on fine-tuning Flux: -https://replicate.com/blog/fine-tune-flux \ No newline at end of file