ginipick commited on
Commit
1497411
1 Parent(s): 2e394d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -0
app.py CHANGED
@@ -124,8 +124,71 @@ footer {
124
  }
125
  """
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  # Gradio UI 구성
128
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
 
 
 
129
  with gr.Column(elem_id="app-container"):
130
  with gr.Row():
131
  with gr.Column(scale=3):
 
124
  }
125
  """
126
 
127
+
128
+ def create_snow_effect():
129
+ # CSS 스타일 정의
130
+ snow_css = """
131
+ @keyframes snowfall {
132
+ 0% {
133
+ transform: translateY(-10vh) translateX(0);
134
+ opacity: 1;
135
+ }
136
+ 100% {
137
+ transform: translateY(100vh) translateX(100px);
138
+ opacity: 0.3;
139
+ }
140
+ }
141
+ .snowflake {
142
+ position: fixed;
143
+ color: white;
144
+ font-size: 1.5em;
145
+ user-select: none;
146
+ z-index: 1000;
147
+ pointer-events: none;
148
+ animation: snowfall linear infinite;
149
+ }
150
+ """
151
+
152
+ # JavaScript 코드 정의
153
+ snow_js = """
154
+ function createSnowflake() {
155
+ const snowflake = document.createElement('div');
156
+ snowflake.innerHTML = '❄';
157
+ snowflake.className = 'snowflake';
158
+ snowflake.style.left = Math.random() * 100 + 'vw';
159
+ snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
160
+ snowflake.style.opacity = Math.random();
161
+ document.body.appendChild(snowflake);
162
+
163
+ setTimeout(() => {
164
+ snowflake.remove();
165
+ }, 5000);
166
+ }
167
+ setInterval(createSnowflake, 200);
168
+ """
169
+
170
+ # CSS와 JavaScript를 결합한 HTML
171
+ snow_html = f"""
172
+ <style>
173
+ {snow_css}
174
+ </style>
175
+ <script>
176
+ {snow_js}
177
+ </script>
178
+ """
179
+
180
+ return gr.HTML(snow_html)
181
+
182
+ # Gradio 앱에서 사용할 때:
183
+ # with app: 아래에
184
+
185
+
186
+
187
  # Gradio UI 구성
188
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
189
+
190
+ create_snow_effect()
191
+
192
  with gr.Column(elem_id="app-container"):
193
  with gr.Row():
194
  with gr.Column(scale=3):