Spaces:
Running
on
Zero
Running
on
Zero
mh
Browse files
app.py
CHANGED
@@ -16,6 +16,60 @@ DESCRIPTION = """
|
|
16 |
# DALL•E 3 XL v2
|
17 |
"""
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def save_image(img):
|
20 |
unique_name = str(uuid.uuid4()) + ".png"
|
21 |
img.save(unique_name)
|
@@ -164,6 +218,7 @@ footer {
|
|
164 |
}
|
165 |
'''
|
166 |
with gr.Blocks(css=css , theme=gr.themes.Base()) as demo:
|
|
|
167 |
gr.HTML("<h1><center>DALL•E 3 XL v2</center></h1>")
|
168 |
with gr.Row():
|
169 |
with gr.Column(scale=1):
|
|
|
16 |
# DALL•E 3 XL v2
|
17 |
"""
|
18 |
|
19 |
+
def create_snow_effect():
|
20 |
+
# CSS 스타일 정의
|
21 |
+
snow_css = """
|
22 |
+
@keyframes snowfall {
|
23 |
+
0% {
|
24 |
+
transform: translateY(-10vh) translateX(0);
|
25 |
+
opacity: 1;
|
26 |
+
}
|
27 |
+
100% {
|
28 |
+
transform: translateY(100vh) translateX(100px);
|
29 |
+
opacity: 0.3;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
.snowflake {
|
33 |
+
position: fixed;
|
34 |
+
color: white;
|
35 |
+
font-size: 1.5em;
|
36 |
+
user-select: none;
|
37 |
+
z-index: 1000;
|
38 |
+
pointer-events: none;
|
39 |
+
animation: snowfall linear infinite;
|
40 |
+
}
|
41 |
+
"""
|
42 |
+
|
43 |
+
# JavaScript 코드 정의
|
44 |
+
snow_js = """
|
45 |
+
function createSnowflake() {
|
46 |
+
const snowflake = document.createElement('div');
|
47 |
+
snowflake.innerHTML = '❄';
|
48 |
+
snowflake.className = 'snowflake';
|
49 |
+
snowflake.style.left = Math.random() * 100 + 'vw';
|
50 |
+
snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
|
51 |
+
snowflake.style.opacity = Math.random();
|
52 |
+
document.body.appendChild(snowflake);
|
53 |
+
|
54 |
+
setTimeout(() => {
|
55 |
+
snowflake.remove();
|
56 |
+
}, 5000);
|
57 |
+
}
|
58 |
+
setInterval(createSnowflake, 200);
|
59 |
+
"""
|
60 |
+
|
61 |
+
# CSS와 JavaScript를 결합한 HTML
|
62 |
+
snow_html = f"""
|
63 |
+
<style>
|
64 |
+
{snow_css}
|
65 |
+
</style>
|
66 |
+
<script>
|
67 |
+
{snow_js}
|
68 |
+
</script>
|
69 |
+
"""
|
70 |
+
|
71 |
+
return gr.HTML(snow_html)
|
72 |
+
|
73 |
def save_image(img):
|
74 |
unique_name = str(uuid.uuid4()) + ".png"
|
75 |
img.save(unique_name)
|
|
|
218 |
}
|
219 |
'''
|
220 |
with gr.Blocks(css=css , theme=gr.themes.Base()) as demo:
|
221 |
+
create_snow_effect()
|
222 |
gr.HTML("<h1><center>DALL•E 3 XL v2</center></h1>")
|
223 |
with gr.Row():
|
224 |
with gr.Column(scale=1):
|