File size: 4,110 Bytes
97644ca
70eca38
9778625
97644ca
9778625
97644ca
0345ed6
97644ca
 
 
70eca38
97644ca
ee19fd5
97644ca
ee19fd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
title: Time Stream 
emoji: πŸͺ
colorFrom: pink
colorTo: blue
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: input text, a video from the past to the future 
---
Looking at this code, it's a Gradio-based application that generates interpolated images between two concepts using CLIP-guided diffusion with the FLUX model. Let me explain the key components and functionality:

## English Explanation

### Overview
This application creates a "Time Stream" effect by generating a series of images that smoothly transition between two different states or concepts. For example, it can show the progression from a "fresh" tomato to a "rotten" one, creating a time-lapse-like visualization.

### Key Features

1. **CLIP-Guided Image Generation**
   - Uses FLUX.1-schnell model with CLIP guidance
   - Finds latent directions between two concepts using CLIP embeddings
   - Generates intermediate images along this direction

2. **Main Components**
   - **Prompt**: The base description of what to generate
   - **1st/2nd Direction**: Two states to interpolate between (e.g., "Fresh" β†’ "Rotten")
   - **Strength**: Controls how extreme the transformation is
   - **Output**: Creates both an image strip and a looping video

3. **Advanced Options**
   - Number of intermediate images (3-65)
   - CLIP direction iterations (0-400)
   - Inference steps (1-4)
   - Guidance scale (0.1-10.0)
   - Seed control for reproducibility

4. **Output Formats**
   - Individual generated images
   - Image strip showing all transitions
   - Looping video of the transformation
   - Interactive slider to view specific frames

### Technical Implementation
- Uses `spaces.GPU` decorator for GPU acceleration
- Implements AutoencoderTiny for faster processing
- Handles Korean text detection (though warns it's used directly without translation)
- Saves images with unique UUID filenames

### Example Use Cases
- Showing decay/aging processes
- Seasonal changes
- Weather transitions
- Urban development/deterioration
- Any temporal transformation

---

## ν•œκΈ€ μ„€λͺ…

### κ°œμš”
이 μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ 두 κ°€μ§€ λ‹€λ₯Έ μƒνƒœλ‚˜ κ°œλ… 사이λ₯Ό λΆ€λ“œλŸ½κ²Œ μ „ν™˜ν•˜λŠ” 일련의 이미지λ₯Ό μƒμ„±ν•˜μ—¬ "μ‹œκ°„μ˜ 흐름(Time Stream)" 효과λ₯Ό λ§Œλ“­λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, "μ‹ μ„ ν•œ" ν† λ§ˆν† μ—μ„œ "썩은" ν† λ§ˆν† λ‘œμ˜ λ³€ν™” 과정을 λ³΄μ—¬μ£ΌλŠ” μ‹œκ°„ κ²½κ³Ό μ‹œκ°ν™”λ₯Ό 생성할 수 μžˆμŠ΅λ‹ˆλ‹€.

### μ£Όμš” κΈ°λŠ₯

1. **CLIP κ°€μ΄λ“œ 이미지 생성**
   - CLIP κ°€μ΄λ˜μŠ€μ™€ ν•¨κ»˜ FLUX.1-schnell λͺ¨λΈ μ‚¬μš©
   - CLIP μž„λ² λ”©μ„ μ‚¬μš©ν•˜μ—¬ 두 κ°œλ… μ‚¬μ΄μ˜ 잠재 λ°©ν–₯ μ°ΎκΈ°
   - 이 λ°©ν–₯을 따라 쀑간 이미지듀을 생성

2. **μ£Όμš” ꡬ성 μš”μ†Œ**
   - **ν”„λ‘¬ν”„νŠΈ**: 생성할 λŒ€μƒμ˜ κΈ°λ³Έ μ„€λͺ…
   - **1μ°¨/2μ°¨ λ°©ν–₯**: 보간할 두 κ°€μ§€ μƒνƒœ (예: "μ‹ μ„ ν•œ" β†’ "썩은")
   - **강도**: λ³€ν™˜μ˜ 극단성을 μ œμ–΄
   - **좜λ ₯**: 이미지 슀트립과 루핑 λΉ„λ””μ˜€ λͺ¨λ‘ 생성

3. **κ³ κΈ‰ μ˜΅μ…˜**
   - 쀑간 이미지 수 (3-65개)
   - CLIP λ°©ν–₯ 반볡 횟수 (0-400회)
   - μΆ”λ‘  단계 (1-4단계)
   - κ°€μ΄λ˜μŠ€ μŠ€μΌ€μΌ (0.1-10.0)
   - μž¬ν˜„μ„±μ„ μœ„ν•œ μ‹œλ“œ μ œμ–΄

4. **좜λ ₯ ν˜•μ‹**
   - κ°œλ³„ 생성 이미지
   - λͺ¨λ“  μ „ν™˜μ„ λ³΄μ—¬μ£ΌλŠ” 이미지 슀트립
   - λ³€ν™˜ κ³Όμ •μ˜ 루핑 λΉ„λ””μ˜€
   - νŠΉμ • ν”„λ ˆμž„μ„ λ³Ό 수 μžˆλŠ” μΈν„°λž™ν‹°λΈŒ μŠ¬λΌμ΄λ”

### 기술적 κ΅¬ν˜„
- GPU 가속을 μœ„ν•œ `spaces.GPU` λ°μ½”λ ˆμ΄ν„° μ‚¬μš©
- λΉ λ₯Έ 처리λ₯Ό μœ„ν•œ AutoencoderTiny κ΅¬ν˜„
- ν•œκΈ€ ν…μŠ€νŠΈ 감지 처리 (λ²ˆμ—­ 없이 직접 μ‚¬μš©λœλ‹€λŠ” κ²½κ³  ν‘œμ‹œ)
- κ³ μœ ν•œ UUID 파일λͺ…μœΌλ‘œ 이미지 μ €μž₯

### μ‚¬μš© μ˜ˆμ‹œ
- λΆ€νŒ¨/λ…Έν™” κ³Όμ • ν‘œν˜„
- κ³„μ ˆ λ³€ν™”
- 날씨 μ „ν™˜
- λ„μ‹œ 개발/쇠퇴
- λͺ¨λ“  μ‹œκ°„μ  λ³€ν™˜

### 참고사항
- ν•œκΈ€ μž…λ ₯은 μ§€μ›λ˜μ§€λ§Œ λͺ¨λΈμ΄ μ˜μ–΄μ— μ΅œμ ν™”λ˜μ–΄ μžˆμ–΄ κ²°κ³Όκ°€ μ œν•œμ μΌ 수 있음
- 강도(Strength) 값이 2.5 이상일 경우 λΆˆμ•ˆμ •ν•  수 있음
- 쀑간 이미지 μˆ˜κ°€ λ§Žμ„μˆ˜λ‘ 더 λΆ€λ“œλŸ¬μš΄ μ „ν™˜ 효과λ₯Ό 얻을 수 있음