Skip to content

Commit

Permalink
docs: simplify README and update requirements
Browse files Browse the repository at this point in the history
Update README.md with clearer instructions and a more concise
overview of the project. Remove Pillow from requirements.txt as it's
no longer needed.
  • Loading branch information
rtuszik committed Aug 25, 2024
1 parent f70d448 commit d8e3f4e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 53 deletions.
93 changes: 41 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,72 @@
# Flux Replicate GUI

This application provides a user-friendly web interface for running Flux1 models using the Replicate API. It's designed specifically for users who want to utilize LoRAs (Low-Rank Adaptations) of Flux created with the [ostris/flux-dev-lora-trainer](https://replicate.com/ostris/flux-dev-lora-trainer/train).
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.

## Features
## What it does

- Web-based GUI for easy interaction with Flux1 LoRAs
- Integration with Replicate API for model execution
- Support for custom LoRAs trained with flux-dev-lora-trainer
- Ability to disable the Safety Checker (API-exclusive feature)
- Customizable image generation parameters
- Image gallery for viewing generated images
- Settings persistence for a smoother user experience
- 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

## Prerequisites
## Setup

- Python 3.7+
- Replicate API key

## Installation

1. Clone this repository:
1. Clone the repo:
```
git clone https://github.com/yourusername/flux-replicate-gui.git
cd flux-replicate-gui
```

2. Install the required dependencies:
2. Create and activate a virtual environment:
```
pip install -r requirements.txt
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
```

3. Set up your Replicate API key as an environment variable:
3. Install dependencies:
```
export REPLICATE_API_TOKEN=your_api_key_here
pip install -r requirements.txt
```

## Usage

1. Run the application:
4. Set your Replicate API key:
```
python3 main.py
export REPLICATE_API_TOKEN=your_api_key_here
```
On Windows, use `set REPLICATE_API_TOKEN=your_api_key_here`

2. Open your web browser and navigate to `http://localhost:8080`
## Run it

3. In the GUI:
- Enter your Replicate model URL
- Set your desired parameters (aspect ratio, number of outputs, etc.)
- Enter your prompt
- Click "Generate Images"
1. Make sure your virtual environment is activated

4. View your generated images in the gallery

## Key Components
2. Start the app:
```
python main.py
```

- `main.py`: Entry point of the application
- `gui.py`: Defines the web interface using NiceGUI
- `image_generator.py`: Handles image generation using the Replicate API
- `utils.py`: Contains utility classes and functions
3. Open `http://localhost:8080` in your browser

## Customization
4. Choose a model, set your options, enter a prompt, and generate images
## Docker

You can modify various parameters in the GUI, including:
**Docker is currently experimental.**

- Flux model selection (dev or schnell)
- Aspect ratio
- Number of outputs
- LoRA scale
- Number of inference steps
- Guidance scale
- Output format and quality
- Safety checker toggle
To run the app in a Docker container, follow these steps:

## Training Your Own Models
1. Make sure you have Docker installed on your system.
2. Build the Docker image:
```
docker build -t flux-replicate-gui .
```
Run the Docker container:
```
docker run -p 8080:8080 flux-replicate-gui
```
Open `http://localhost:8080` in your browser

To train your own models for use with this GUI, please refer to the Replicate guide on fine-tuning Flux:

[Fine-tune Flux: Create your own image generation model](https://replicate.com/blog/fine-tune-flux)

## License
## Need help?

[GNU GPLv3e](LICENSE)
Check out Replicate's guide on fine-tuning Flux:
https://replicate.com/blog/fine-tune-flux
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
replicate==0.32.0
python-dotenv==1.0.1
token_count==0.2.1
pillow==10.4.0
loguru==0.7.2
nicegui==1.4.36
httpx==0.27.0

0 comments on commit d8e3f4e

Please sign in to comment.