File size: 1,969 Bytes
632672e
 
17a14e9
a12f521
 
15f2ccc
 
17a14e9
 
 
a12f521
8eb9ce4
3e1c3ec
17a14e9
 
 
 
15f2ccc
a12f521
17a14e9
 
15f2ccc
17a14e9
15f2ccc
a12f521
17a14e9
15f2ccc
17a14e9
 
1fdff79
3e1c3ec
17a14e9
 
15f2ccc
17a14e9
 
 
 
15f2ccc
 
 
1fdff79
a12f521
 
 
 
 
 
 
1fdff79
 
 
 
 
 
 
 
 
9af3c99
8eb9ce4
9af3c99
a12f521
9af3c99
8eb9ce4
9af3c99
 
3e1c3ec
9af3c99
a12f521
9af3c99
15f2ccc
 
8eb9ce4
9af3c99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# FaceEnhance
Enhancing faces in AI generated images.

<div style="text-align: center;">
  <img src="examples/elon_compare.gif" alt="Elon Comparison" width="600"/>
</div>

## Installation

### Prerequisites
- Python 3.11 or higher
- 1 GPU with 48GB VRAM
- At least 50GB of free disk space

### Setup

1. Set up your Hugging Face token:
   - Create a token at [Hugging Face](https://huggingface.co/settings/tokens)
   - Set the following environment variables:
     ```
     export HUGGINGFACE_TOKEN=your_token_here
     export HF_HOME=/path/to/your/huggingface_cache
     ```
   - Models will be downloaded to `$HF_HOME` and then symlinked to `./ComfyUI/models/`
   - Hugging Face requires login for downloading Flux

2. Create the virtual environment:
   ```
   python -m venv venv
   source venv/bin/activate
   python -m pip install -r requirements.txt
   ```

3. Run the install script:
   ```
   python install.py
   ```

This will
- Install ComfyUI, custom nodes, and required dependencies to your venv
- Download all required models (Flux.1-dev, ControlNet, text encoders, PuLID, and more)

## Running on ComfyUI

Using the ComfyUI workflows is the fastest way to get started. Run `python run_comfy.py`
- `./workflows/FaceEnhancementProd.json` for face enhancement
- `./workflows/FaceEmbedDist.json` for computing the face embed distance


## Configuration

Create a .env file in the project root directory with your API keys:
```
touch .env
echo "FAL_API_KEY=your_fal_api_key_here" >> .env
```

These API keys are required for certain features of the application to work properly.

# Gradio Demo

A simple web interface for the face enhancement workflow. 

1. Run

```bash
python gradio_demo.py
```
2. Go to http://localhost:7860. You may need to enable port forwarding.

### Notes
- The script and demo run a ComfyUI server ephemerally
- All images are saved in ./ComfyUI/input/scratch/
- Temporary files are created during processing and cleaned up afterward