ginipick commited on
Commit
644e663
ยท
verified ยท
1 Parent(s): 3acf08f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +116 -1
README.md CHANGED
@@ -10,5 +10,120 @@ pinned: true
10
  license: mit
11
  short_description: mcp_server & High quality Images in Realtime
12
  ---
 
13
 
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: mit
11
  short_description: mcp_server & High quality Images in Realtime
12
  ---
13
+ Looking at this code, it's a Gradio-based application for real-time image generation using the FLUX.1-schnell model. Here's a detailed explanation:
14
 
15
+ ## English Explanation
16
+
17
+ ### Overview
18
+ This application provides a real-time image generation interface using the FLUX.1-schnell diffusion model. It features instant preview capabilities where images are generated as you type, making it highly interactive and user-friendly.
19
+
20
+ ### Key Features
21
+
22
+ 1. **Real-time Generation**
23
+ - Images are generated automatically as you type in the prompt
24
+ - Uses GPU acceleration with `@spaces.GPU` decorator
25
+ - Optimized for fast inference with only 1-4 steps
26
+
27
+ 2. **User Interface Components**
28
+ - **Prompt Input**: Text area for describing desired images
29
+ - **Generated Image**: Real-time display of generated results
30
+ - **Enhance Button**: Manual trigger for image generation
31
+ - **Latency Display**: Shows processing time for each generation
32
+
33
+ 3. **Advanced Options**
34
+ - **Seed Control**: For reproducible results (0 to 2ยณยฒ-1)
35
+ - **Randomize Seed**: Toggle for random seed generation
36
+ - **Width/Height Sliders**: Image dimensions (256-2048 pixels)
37
+ - **Inference Steps**: Control generation quality/speed (1-4 steps)
38
+
39
+ 4. **Special Features**
40
+ - **Snow Effect**: Animated snowflakes falling across the interface
41
+ - **Korean Text Detection**: Warns when Korean text is detected in prompts
42
+ - **Example Gallery**: Pre-defined creative prompts for inspiration
43
+ - **Automatic CUDA Cache Clearing**: Prevents memory overflow
44
+
45
+ ### Technical Implementation
46
+
47
+ 1. **Model Configuration**
48
+ - Uses FLUX.1-schnell with float16 precision for efficiency
49
+ - Custom pipeline with intermediate outputs capability
50
+ - GPU duration limited to 15 seconds per generation
51
+
52
+ 2. **Input Validation**
53
+ - Automatic size constraints (256-2048 pixels)
54
+ - Seed validation and randomization
55
+ - Error handling with graceful fallbacks
56
+
57
+ 3. **Performance Optimizations**
58
+ - Automatic Mixed Precision (AMP) for faster computation
59
+ - CUDA cache clearing after each generation
60
+ - Minimal inference steps for real-time performance
61
+
62
+ ### Example Prompts Included
63
+ - Steampunk owl in Victorian clothing
64
+ - Floating island made of books
65
+ - Bioluminescent cyberpunk forest
66
+ - Ancient temple with robot archaeologists
67
+ - Cosmic coffee shop with constellation baristas
68
+
69
+ ---
70
+
71
+ ## ํ•œ๊ธ€ ์„ค๋ช…
72
+
73
+ ### ๊ฐœ์š”
74
+ ์ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ FLUX.1-schnell ํ™•์‚ฐ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•œ ์‹ค์‹œ๊ฐ„ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ์ธํ„ฐํŽ˜์ด์Šค์ž…๋‹ˆ๋‹ค. ํƒ€์ดํ•‘ํ•˜๋Š” ๋™์•ˆ ์ฆ‰์‹œ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋˜๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜์—ฌ ๋งค์šฐ ์ƒํ˜ธ์ž‘์šฉ์ ์ด๊ณ  ์‚ฌ์šฉ์ž ์นœํ™”์ ์ž…๋‹ˆ๋‹ค.
75
+
76
+ ### ์ฃผ์š” ๊ธฐ๋Šฅ
77
+
78
+ 1. **์‹ค์‹œ๊ฐ„ ์ƒ์„ฑ**
79
+ - ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋Š” ๋™์•ˆ ์ž๋™์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ
80
+ - `@spaces.GPU` ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋ฅผ ํ†ตํ•œ GPU ๊ฐ€์†
81
+ - 1-4 ๋‹จ๊ณ„๋งŒ์œผ๋กœ ๋น ๋ฅธ ์ถ”๋ก  ์ตœ์ ํ™”
82
+
83
+ 2. **์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ์š”์†Œ**
84
+ - **ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ**: ์›ํ•˜๋Š” ์ด๋ฏธ์ง€๋ฅผ ์„ค๋ช…ํ•˜๋Š” ํ…์ŠคํŠธ ์˜์—ญ
85
+ - **์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€**: ์ƒ์„ฑ ๊ฒฐ๊ณผ์˜ ์‹ค์‹œ๊ฐ„ ํ‘œ์‹œ
86
+ - **ํ–ฅ์ƒ ๋ฒ„ํŠผ**: ์ˆ˜๋™ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ํŠธ๋ฆฌ๊ฑฐ
87
+ - **์ง€์—ฐ ์‹œ๊ฐ„ ํ‘œ์‹œ**: ๊ฐ ์ƒ์„ฑ์˜ ์ฒ˜๋ฆฌ ์‹œ๊ฐ„ ํ‘œ์‹œ
88
+
89
+ 3. **๊ณ ๊ธ‰ ์˜ต์…˜**
90
+ - **์‹œ๋“œ ์ œ์–ด**: ์žฌํ˜„ ๊ฐ€๋Šฅํ•œ ๊ฒฐ๊ณผ๋ฅผ ์œ„ํ•œ ์„ค์ • (0 ~ 2ยณยฒ-1)
91
+ - **์‹œ๋“œ ๋ฌด์ž‘์œ„ํ™”**: ๋ฌด์ž‘์œ„ ์‹œ๋“œ ์ƒ์„ฑ ํ† ๊ธ€
92
+ - **๋„ˆ๋น„/๋†’์ด ์Šฌ๋ผ์ด๋”**: ์ด๋ฏธ์ง€ ํฌ๊ธฐ (256-2048 ํ”ฝ์…€)
93
+ - **์ถ”๋ก  ๋‹จ๊ณ„**: ์ƒ์„ฑ ํ’ˆ์งˆ/์†๋„ ์ œ์–ด (1-4 ๋‹จ๊ณ„)
94
+
95
+ 4. **ํŠน๋ณ„ ๊ธฐ๋Šฅ**
96
+ - **๋ˆˆ ํšจ๊ณผ**: ์ธํ„ฐํŽ˜์ด์Šค ์ „์ฒด์— ๋–จ์–ด์ง€๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ˆˆ์†ก์ด
97
+ - **ํ•œ๊ธ€ ํ…์ŠคํŠธ ๊ฐ์ง€**: ํ”„๋กฌํ”„ํŠธ์— ํ•œ๊ธ€์ด ๊ฐ์ง€๋˜๋ฉด ๊ฒฝ๊ณ  ํ‘œ์‹œ
98
+ - **์˜ˆ์ œ ๊ฐค๋Ÿฌ๋ฆฌ**: ์˜๊ฐ์„ ์œ„ํ•œ ์‚ฌ์ „ ์ •์˜๋œ ์ฐฝ์˜์  ํ”„๋กฌํ”„ํŠธ
99
+ - **์ž๋™ CUDA ์บ์‹œ ์ •๋ฆฌ**: ๋ฉ”๋ชจ๋ฆฌ ์˜ค๋ฒ„ํ”Œ๋กœ ๋ฐฉ์ง€
100
+
101
+ ### ๊ธฐ์ˆ ์  ๊ตฌํ˜„
102
+
103
+ 1. **๋ชจ๋ธ ๊ตฌ์„ฑ**
104
+ - ํšจ์œจ์„ฑ์„ ์œ„ํ•œ float16 ์ •๋ฐ€๋„์˜ FLUX.1-schnell ์‚ฌ์šฉ
105
+ - ์ค‘๊ฐ„ ์ถœ๋ ฅ ๊ธฐ๋Šฅ์ด ์žˆ๋Š” ์ปค์Šคํ…€ ํŒŒ์ดํ”„๋ผ์ธ
106
+ - ์ƒ์„ฑ๋‹น GPU ์‹œ๊ฐ„์„ 15์ดˆ๋กœ ์ œํ•œ
107
+
108
+ 2. **์ž…๋ ฅ ๊ฒ€์ฆ**
109
+ - ์ž๋™ ํฌ๊ธฐ ์ œ์•ฝ (256-2048 ํ”ฝ์…€)
110
+ - ์‹œ๋“œ ๊ฒ€์ฆ ๋ฐ ๋ฌด์ž‘์œ„ํ™”
111
+ - ์šฐ์•„ํ•œ ํด๋ฐฑ์„ ํ†ตํ•œ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ
112
+
113
+ 3. **์„ฑ๋Šฅ ์ตœ์ ํ™”**
114
+ - ๋น ๋ฅธ ๊ณ„์‚ฐ์„ ์œ„ํ•œ ์ž๋™ ํ˜ผํ•ฉ ์ •๋ฐ€๋„(AMP)
115
+ - ๊ฐ ์ƒ์„ฑ ํ›„ CUDA ์บ์‹œ ์ •๋ฆฌ
116
+ - ์‹ค์‹œ๊ฐ„ ์„ฑ๋Šฅ์„ ์œ„ํ•œ ์ตœ์†Œ ์ถ”๋ก  ๋‹จ๊ณ„
117
+
118
+ ### ํฌํ•จ๋œ ์˜ˆ์ œ ํ”„๋กฌํ”„ํŠธ
119
+ - ๋น…ํ† ๋ฆฌ์•„ ์‹œ๋Œ€ ์˜์ƒ์„ ์ž…์€ ์ŠคํŒ€ํŽ‘ํฌ ์˜ฌ๋นผ๋ฏธ
120
+ - ์ฑ…์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ๋– ๋‹ค๋‹ˆ๋Š” ์„ฌ
121
+ - ์ƒ๋ฌผ๋ฐœ๊ด‘ ์‚ฌ์ด๋ฒ„ํŽ‘ํฌ ์ˆฒ
122
+ - ๋กœ๋ด‡ ๊ณ ๊ณ ํ•™์ž๊ฐ€ ์žˆ๋Š” ๊ณ ๋Œ€ ์‚ฌ์›
123
+ - ๋ณ„์ž๋ฆฌ ๋ฐ”๋ฆฌ์Šคํƒ€๊ฐ€ ์žˆ๋Š” ์šฐ์ฃผ ์ปคํ”ผ์ˆ
124
+
125
+ ### ์‚ฌ์šฉ ํŒ
126
+ - ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋Š” ์ง€์›๋˜์ง€๋งŒ ์˜์–ด ํ”„๋กฌํ”„ํŠธ๊ฐ€ ๋” ๋‚˜์€ ๊ฒฐ๊ณผ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค
127
+ - ๋น ๋ฅธ ๏ฟฝ๏ฟฝ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์œ„ํ•ด ์ถ”๋ก  ๋‹จ๊ณ„๋ฅผ ๋‚ฎ๊ฒŒ ์œ ์ง€ํ•˜์„ธ์š”
128
+ - ๊ณ ํ’ˆ์งˆ ์ด๋ฏธ์ง€๋ฅผ ์œ„ํ•ด์„œ๋Š” "ํ–ฅ์ƒ" ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์„ธ์š”
129
+ - ์‹œ๋“œ ๊ฐ’์„ ๊ณ ์ •ํ•˜๋ฉด ๋™์ผํ•œ ์ด๋ฏธ์ง€๋ฅผ ์žฌ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค