Spaces:
Running
on
Zero
Running
on
Zero
Update README.md
Browse files
README.md
CHANGED
@@ -8,5 +8,119 @@ sdk_version: 5.35.0
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
+
I'll create comprehensive documentation for this Flux LoRA Rolls-Royce image generation code in both English and Korean.
|
12 |
|
13 |
+
## English Documentation
|
14 |
+
|
15 |
+
### Flux LoRA Rolls-Royce Image Generator
|
16 |
+
|
17 |
+
This application is a specialized image generation tool that uses the FLUX.1-dev diffusion model with a custom LoRA (Low-Rank Adaptation) fine-tuned specifically for generating high-quality Rolls-Royce automobile images.
|
18 |
+
|
19 |
+
#### Key Features
|
20 |
+
|
21 |
+
1. **Advanced AI Model Integration**
|
22 |
+
- Utilizes the state-of-the-art FLUX.1-dev diffusion pipeline from Black Forest Labs
|
23 |
+
- Incorporates a custom LoRA adapter (`seawolf2357/flux-lora-car-rolls-royce`) specifically trained on Rolls-Royce vehicles
|
24 |
+
- Supports both CUDA GPU acceleration and CPU fallback for broader compatibility
|
25 |
+
|
26 |
+
2. **Persistent Image Storage**
|
27 |
+
- Automatically saves all generated images with unique timestamps and UUIDs
|
28 |
+
- Maintains a metadata file tracking prompts and generation times
|
29 |
+
- Provides a gallery view for browsing previously generated images
|
30 |
+
|
31 |
+
3. **User-Friendly Interface**
|
32 |
+
- Built with Gradio for an intuitive web-based interface
|
33 |
+
- Features two main tabs: Generation and Gallery
|
34 |
+
- Includes pre-written example prompts showcasing various Rolls-Royce models in luxurious settings
|
35 |
+
|
36 |
+
4. **Customizable Generation Parameters**
|
37 |
+
- **Seed Control**: Option for randomization or manual seed setting for reproducibility
|
38 |
+
- **Image Dimensions**: Adjustable width and height (up to 1024x1024 pixels)
|
39 |
+
- **Guidance Scale**: Controls how closely the image follows the prompt (0.0-10.0)
|
40 |
+
- **Inference Steps**: Number of denoising steps (1-50)
|
41 |
+
- **LoRA Scale**: Strength of the Rolls-Royce-specific adaptation (0.0-1.0)
|
42 |
+
|
43 |
+
#### Technical Implementation
|
44 |
+
|
45 |
+
The application leverages several key technologies:
|
46 |
+
- **PyTorch** for deep learning operations
|
47 |
+
- **Diffusers** library for the diffusion model pipeline
|
48 |
+
- **Gradio** for the web interface
|
49 |
+
- **Spaces GPU** decorator for optimized GPU usage (120-second duration limit)
|
50 |
+
|
51 |
+
The generation process:
|
52 |
+
1. Loads the base FLUX.1-dev model with bfloat16 precision for memory efficiency
|
53 |
+
2. Applies the Rolls-Royce LoRA weights for specialized car generation
|
54 |
+
3. Processes user prompts with specified parameters
|
55 |
+
4. Saves generated images automatically with metadata
|
56 |
+
5. Updates the gallery view with new creations
|
57 |
+
|
58 |
+
#### Example Use Cases
|
59 |
+
|
60 |
+
The included examples demonstrate various scenarios:
|
61 |
+
- Classic Rolls-Royce models in architectural settings
|
62 |
+
- Modern vehicles in urban environments
|
63 |
+
- Luxury SUVs in natural landscapes
|
64 |
+
- Vintage cars in historical contexts
|
65 |
+
- High-performance models in exclusive locations
|
66 |
+
|
67 |
+
Each prompt includes the `[trigger]` keyword to activate the LoRA adaptation effectively.
|
68 |
+
|
69 |
+
---
|
70 |
+
|
71 |
+
## ํ๊ธ ์ค๋ช
์
|
72 |
+
|
73 |
+
### Flux LoRA ๋กค์ค๋ก์ด์ค ์ด๋ฏธ์ง ์์ฑ๊ธฐ
|
74 |
+
|
75 |
+
์ด ์ ํ๋ฆฌ์ผ์ด์
์ FLUX.1-dev ํ์ฐ ๋ชจ๋ธ๊ณผ ๋กค์ค๋ก์ด์ค ์๋์ฐจ ์ด๋ฏธ์ง ์์ฑ์ ํนํ๋ ์ปค์คํ
LoRA(Low-Rank Adaptation)๋ฅผ ์ฌ์ฉํ๋ ์ ๋ฌธ ์ด๋ฏธ์ง ์์ฑ ๋๊ตฌ์
๋๋ค.
|
76 |
+
|
77 |
+
#### ์ฃผ์ ๊ธฐ๋ฅ
|
78 |
+
|
79 |
+
1. **๊ณ ๊ธ AI ๋ชจ๋ธ ํตํฉ**
|
80 |
+
- Black Forest Labs์ ์ต์ฒจ๋จ FLUX.1-dev ํ์ฐ ํ์ดํ๋ผ์ธ ํ์ฉ
|
81 |
+
- ๋กค์ค๋ก์ด์ค ์ฐจ๋ ์ ์ฉ์ผ๋ก ํ์ต๋ ์ปค์คํ
LoRA ์ด๋ํฐ(`seawolf2357/flux-lora-car-rolls-royce`) ์ ์ฉ
|
82 |
+
- CUDA GPU ๊ฐ์ ๋ฐ CPU ํด๋ฐฑ ์ง์์ผ๋ก ํญ๋์ ํธํ์ฑ ์ ๊ณต
|
83 |
+
|
84 |
+
2. **์๊ตฌ ์ด๋ฏธ์ง ์ ์ฅ**
|
85 |
+
- ์์ฑ๋ ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ณ ์ ํ ํ์์คํฌํ์ UUID๋ก ์๋ ์ ์ฅ
|
86 |
+
- ํ๋กฌํํธ์ ์์ฑ ์๊ฐ์ ์ถ์ ํ๋ ๋ฉํ๋ฐ์ดํฐ ํ์ผ ์ ์ง
|
87 |
+
- ์ด์ ์ ์์ฑ๋ ์ด๋ฏธ์ง๋ฅผ ํ์ํ ์ ์๋ ๊ฐค๋ฌ๋ฆฌ ๋ทฐ ์ ๊ณต
|
88 |
+
|
89 |
+
3. **์ฌ์ฉ์ ์นํ์ ์ธํฐํ์ด์ค**
|
90 |
+
- Gradio๋ฅผ ์ฌ์ฉํ ์ง๊ด์ ์ธ ์น ๊ธฐ๋ฐ ์ธํฐํ์ด์ค ๊ตฌ์ถ
|
91 |
+
- ์์ฑ(Generation)๊ณผ ๊ฐค๋ฌ๋ฆฌ(Gallery) ๋ ๊ฐ์ ์ฃผ์ ํญ ์ ๊ณต
|
92 |
+
- ๋ค์ํ ๋กค์ค๋ก์ด์ค ๋ชจ๋ธ์ ๊ณ ๊ธ์ค๋ฌ์ด ํ๊ฒฝ์์ ๋ณด์ฌ์ฃผ๋ ์์ ํ๋กฌํํธ ํฌํจ
|
93 |
+
|
94 |
+
4. **๋ง์ถคํ ์์ฑ ๋งค๊ฐ๋ณ์**
|
95 |
+
- **์๋ ์ ์ด**: ์ฌํ์ฑ์ ์ํ ๋ฌด์์ํ ๋๋ ์๋ ์๋ ์ค์ ์ต์
|
96 |
+
- **์ด๋ฏธ์ง ํฌ๊ธฐ**: ์กฐ์ ๊ฐ๋ฅํ ๋๋น์ ๋์ด (์ต๋ 1024x1024 ํฝ์
)
|
97 |
+
- **๊ฐ์ด๋์ค ์ค์ผ์ผ**: ํ๋กฌํํธ ์ค์ ์ ๋ ์ ์ด (0.0-10.0)
|
98 |
+
- **์ถ๋ก ๋จ๊ณ**: ๋
ธ์ด์ฆ ์ ๊ฑฐ ๋จ๊ณ ์ (1-50)
|
99 |
+
- **LoRA ์ค์ผ์ผ**: ๋กค์ค๋ก์ด์ค ํนํ ์ ์ ๊ฐ๋ (0.0-1.0)
|
100 |
+
|
101 |
+
#### ๊ธฐ์ ์ ๊ตฌํ
|
102 |
+
|
103 |
+
์ ํ๋ฆฌ์ผ์ด์
์ ๋ค์๊ณผ ๊ฐ์ ํต์ฌ ๊ธฐ์ ์ ํ์ฉํฉ๋๋ค:
|
104 |
+
- ๋ฅ๋ฌ๋ ์ฐ์ฐ์ ์ํ **PyTorch**
|
105 |
+
- ํ์ฐ ๋ชจ๋ธ ํ์ดํ๋ผ์ธ์ ์ํ **Diffusers** ๋ผ์ด๋ธ๋ฌ๋ฆฌ
|
106 |
+
- ์น ์ธํฐํ์ด์ค๋ฅผ ์ํ **Gradio**
|
107 |
+
- ์ต์ ํ๋ GPU ์ฌ์ฉ์ ์ํ **Spaces GPU** ๋ฐ์ฝ๋ ์ดํฐ (120์ด ์๊ฐ ์ ํ)
|
108 |
+
|
109 |
+
์์ฑ ํ๋ก์ธ์ค:
|
110 |
+
1. ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ์ํด bfloat16 ์ ๋ฐ๋๋ก ๊ธฐ๋ณธ FLUX.1-dev ๋ชจ๋ธ ๋ก๋
|
111 |
+
2. ์ ๋ฌธ ์๋์ฐจ ์์ฑ์ ์ํ ๋กค์ค๋ก์ด์ค LoRA ๊ฐ์ค์น ์ ์ฉ
|
112 |
+
3. ์ง์ ๋ ๋งค๊ฐ๋ณ์๋ก ์ฌ์ฉ์ ํ๋กฌํํธ ์ฒ๋ฆฌ
|
113 |
+
4. ์์ฑ๋ ์ด๋ฏธ๏ฟฝ๏ฟฝ๋ฅผ ๋ฉํ๋ฐ์ดํฐ์ ํจ๊ป ์๋ ์ ์ฅ
|
114 |
+
5. ์๋ก์ด ์์ฑ๋ฌผ๋ก ๊ฐค๋ฌ๋ฆฌ ๋ทฐ ์
๋ฐ์ดํธ
|
115 |
+
|
116 |
+
#### ์ฌ์ฉ ์์
|
117 |
+
|
118 |
+
ํฌํจ๋ ์์ ๋ค์ ๋ค์ํ ์๋๋ฆฌ์ค๋ฅผ ๋ณด์ฌ์ค๋๋ค:
|
119 |
+
- ๊ฑด์ถ์ ๋ฐฐ๊ฒฝ์ ํด๋์ ๋กค์ค๋ก์ด์ค ๋ชจ๋ธ
|
120 |
+
- ๋์ ํ๊ฒฝ์ ํ๋์ ์ฐจ๋
|
121 |
+
- ์์ฐ ํ๊ฒฝ ์์ ๋ญ์
๋ฆฌ SUV
|
122 |
+
- ์ญ์ฌ์ ๋งฅ๋ฝ์ ๋นํฐ์ง ์๋์ฐจ
|
123 |
+
- ๋
์ ์ ์ธ ์ฅ์์ ๊ณ ์ฑ๋ฅ ๋ชจ๋ธ
|
124 |
+
|
125 |
+
๊ฐ ํ๋กฌํํธ์๋ LoRA ์ ์์ ํจ๊ณผ์ ์ผ๋ก ํ์ฑํํ๊ธฐ ์ํ `[trigger]` ํค์๋๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.
|
126 |
|