fantaxy commited on
Commit
5f357ae
ยท
verified ยท
1 Parent(s): 1ffbca1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -0
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