Spaces:
Paused
Paused
Update README.md
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
- ์๋ ๊ฐ์ ๊ณ ์ ํ๋ฉด ๋์ผํ ์ด๋ฏธ์ง๋ฅผ ์ฌ์์ฑํ ์ ์์ต๋๋ค
|