fantaxy commited on
Commit
0fa1f6e
·
verified ·
1 Parent(s): 2c90498

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -1
app.py CHANGED
@@ -158,11 +158,67 @@ footer {
158
  }
159
  """
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu",
162
  offload: bool = False):
163
 
164
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
165
-
166
 
167
  with gr.Row():
168
  with gr.Column():
 
158
  }
159
  """
160
 
161
+
162
+ def create_snow_effect():
163
+ # CSS 스타일 정의
164
+ snow_css = """
165
+ @keyframes snowfall {
166
+ 0% {
167
+ transform: translateY(-10vh) translateX(0);
168
+ opacity: 1;
169
+ }
170
+ 100% {
171
+ transform: translateY(100vh) translateX(100px);
172
+ opacity: 0.3;
173
+ }
174
+ }
175
+ .snowflake {
176
+ position: fixed;
177
+ color: white;
178
+ font-size: 1.5em;
179
+ user-select: none;
180
+ z-index: 1000;
181
+ pointer-events: none;
182
+ animation: snowfall linear infinite;
183
+ }
184
+ """
185
+
186
+ # JavaScript 코드 정의
187
+ snow_js = """
188
+ function createSnowflake() {
189
+ const snowflake = document.createElement('div');
190
+ snowflake.innerHTML = '❄';
191
+ snowflake.className = 'snowflake';
192
+ snowflake.style.left = Math.random() * 100 + 'vw';
193
+ snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
194
+ snowflake.style.opacity = Math.random();
195
+ document.body.appendChild(snowflake);
196
+
197
+ setTimeout(() => {
198
+ snowflake.remove();
199
+ }, 5000);
200
+ }
201
+ setInterval(createSnowflake, 200);
202
+ """
203
+
204
+ # CSS와 JavaScript를 결합한 HTML
205
+ snow_html = f"""
206
+ <style>
207
+ {snow_css}
208
+ </style>
209
+ <script>
210
+ {snow_js}
211
+ </script>
212
+ """
213
+
214
+ return gr.HTML(snow_html)
215
+
216
+
217
  def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu",
218
  offload: bool = False):
219
 
220
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
221
+ create_snow_effect()
222
 
223
  with gr.Row():
224
  with gr.Column():