File size: 2,118 Bytes
632672e
 
17a14e9
 
 
 
 
8eb9ce4
3e1c3ec
17a14e9
 
 
 
8eb9ce4
 
17a14e9
 
 
8eb9ce4
 
 
 
 
17a14e9
8eb9ce4
17a14e9
 
1fdff79
3e1c3ec
17a14e9
 
8eb9ce4
17a14e9
 
 
 
 
1fdff79
8eb9ce4
 
1fdff79
 
 
 
 
 
 
 
 
 
 
9af3c99
8eb9ce4
9af3c99
8eb9ce4
9af3c99
8eb9ce4
9af3c99
 
3e1c3ec
9af3c99
 
8eb9ce4
9af3c99
8eb9ce4
9af3c99
 
3e1c3ec
9af3c99
 
 
 
8eb9ce4
9af3c99
 
 
 
 
 
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
76
77
78
79
80
81
82
83
# FaceEnhance
Enhancing faces in AI generated images.

## Installation

### Prerequisites
- Python 3.8 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 it as an environment variable.
   - Set the token as an environment variable. HuggingFace requires login for downloading Flux:
     ```
     export HUGGINGFACE_TOKEN=your_token_here
     ```
    - Set the Hugging Face cache directory:
      ```
      export HF_HOME=/path/to/your/huggingface_cache
      ```
      Models will be downloaded here and then symlinked to ./ComfyUI/models/.

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

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

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

## Configuration

Create a .env file in the project root directory with your API keys:
```
touch .env
echo "OPENAI_API_KEY=your_openai_api_key_here" >> .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 web interface for the face enhancement workflow. 

1. Run

```bash
python gradio_demo.py
```

2. Run this on a separate terminal for port-forwarding 
```bash
ssh -L 7860:localhost:7860 root@[IP_ADDRESS] -p [SERVER_PORT] -i [PRIVATE_KEY]
```

3. Go to http://localhost:7860

## Usage

1. Upload an input image you want to enhance
2. Upload a high-quality reference face image
3. Click "Enhance Face" to start the process
4. Wait approximately 60 seconds for processing
5. View the enhanced result in the output panel

## Notes

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