Update app.py
Browse files
app.py
CHANGED
@@ -153,14 +153,58 @@ body {
|
|
153 |
.audio-btn:hover {
|
154 |
background: rgba(39, 174, 96, 0.9);
|
155 |
}
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
|
|
|
|
|
|
|
|
163 |
|
|
|
|
|
|
|
|
|
164 |
|
165 |
with gr.Column(elem_classes="container"):
|
166 |
gr.Markdown("# ๐ X-MAS LoRA", elem_classes="header")
|
@@ -182,53 +226,6 @@ with gr.Blocks(css=css) as app:
|
|
182 |
elem_classes="generate-btn"
|
183 |
)
|
184 |
|
185 |
-
|
186 |
-
# HTML5 ์ค๋์ค ์์ ์ถ๊ฐ
|
187 |
-
gr.HTML("""
|
188 |
-
<div class="audio-controls">
|
189 |
-
<button class="audio-btn" onclick="toggleAudio(1)">Play Music 1</button>
|
190 |
-
<button class="audio-btn" onclick="toggleAudio(2)">Play Music 2</button>
|
191 |
-
<button class="audio-btn" onclick="stopAllAudio()">Stop All</button>
|
192 |
-
</div>
|
193 |
-
<audio id="bgMusic1" loop style="display: none;">
|
194 |
-
<source src="file/1.mp3" type="audio/mp3">
|
195 |
-
</audio>
|
196 |
-
<audio id="bgMusic2" loop style="display: none;">
|
197 |
-
<source src="file/2.mp3" type="audio/mp3">
|
198 |
-
</audio>
|
199 |
-
<script>
|
200 |
-
let currentlyPlaying = null;
|
201 |
-
|
202 |
-
function toggleAudio(num) {
|
203 |
-
const audio = document.getElementById('bgMusic' + num);
|
204 |
-
const otherAudio = document.getElementById('bgMusic' + (num === 1 ? 2 : 1));
|
205 |
-
|
206 |
-
if (currentlyPlaying === audio) {
|
207 |
-
audio.pause();
|
208 |
-
currentlyPlaying = null;
|
209 |
-
} else {
|
210 |
-
if (currentlyPlaying) {
|
211 |
-
currentlyPlaying.pause();
|
212 |
-
}
|
213 |
-
otherAudio.pause();
|
214 |
-
audio.play();
|
215 |
-
currentlyPlaying = audio;
|
216 |
-
}
|
217 |
-
}
|
218 |
-
|
219 |
-
function stopAllAudio() {
|
220 |
-
document.getElementById('bgMusic1').pause();
|
221 |
-
document.getElementById('bgMusic2').pause();
|
222 |
-
currentlyPlaying = null;
|
223 |
-
}
|
224 |
-
</script>
|
225 |
-
""")
|
226 |
-
|
227 |
-
# ์ด๋ฏธ์ง ์ถ๋ ฅ ์์ญ
|
228 |
-
with gr.Group(elem_classes="result-box"):
|
229 |
-
gr.Markdown("### ๐ผ๏ธ Generated Image")
|
230 |
-
result = gr.Image(label="Result", elem_classes="image-output")
|
231 |
-
|
232 |
# ์ต์
๋ค์ ์์ฝ๋์ธ์ผ๋ก ๊ตฌ์ฑ
|
233 |
with gr.Accordion("๐จ Advanced Options", open=False, elem_classes="accordion"):
|
234 |
with gr.Group(elem_classes="parameter-box"):
|
@@ -290,6 +287,47 @@ gr.HTML("""
|
|
290 |
value=example_seed
|
291 |
)
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
app.load(
|
294 |
load_example,
|
295 |
inputs=[],
|
@@ -302,7 +340,5 @@ gr.HTML("""
|
|
302 |
outputs=[result, seed]
|
303 |
)
|
304 |
|
305 |
-
|
306 |
-
# ๋ง์ง๋ง ๋ถ๋ถ์ ๋ค์๊ณผ ๊ฐ์ด ์์
|
307 |
app.queue()
|
308 |
-
app.launch()
|
|
|
153 |
.audio-btn:hover {
|
154 |
background: rgba(39, 174, 96, 0.9);
|
155 |
}
|
156 |
+
@keyframes snow {
|
157 |
+
0% {
|
158 |
+
transform: translateY(0) translateX(0);
|
159 |
+
}
|
160 |
+
100% {
|
161 |
+
transform: translateY(100vh) translateX(100px);
|
162 |
+
}
|
163 |
+
}
|
164 |
|
165 |
+
.snowflake {
|
166 |
+
position: fixed;
|
167 |
+
top: -10px;
|
168 |
+
color: white;
|
169 |
+
font-size: 20px;
|
170 |
+
animation: snow 5s linear infinite;
|
171 |
+
}
|
172 |
+
@keyframes snow {
|
173 |
+
0% {
|
174 |
+
transform: translateY(0) translateX(0);
|
175 |
+
}
|
176 |
+
100% {
|
177 |
+
transform: translateY(100vh) translateX(100px);
|
178 |
+
}
|
179 |
+
}
|
180 |
|
181 |
+
.snowflake {
|
182 |
+
position: fixed;
|
183 |
+
top: -10px;
|
184 |
+
color: white;
|
185 |
+
font-size: 20px;
|
186 |
+
animation: snow 5s linear infinite;
|
187 |
+
}
|
188 |
+
"""
|
189 |
+
js_code = """
|
190 |
+
function createSnowflake() {
|
191 |
+
const snowflake = document.createElement('div');
|
192 |
+
snowflake.classList.add('snowflake');
|
193 |
+
snowflake.innerHTML = 'โ';
|
194 |
+
snowflake.style.left = Math.random() * 100 + 'vw';
|
195 |
+
snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
|
196 |
+
snowflake.style.opacity = Math.random();
|
197 |
+
document.body.appendChild(snowflake);
|
198 |
|
199 |
+
setTimeout(() => {
|
200 |
+
snowflake.remove();
|
201 |
+
}, 5000);
|
202 |
+
}
|
203 |
|
204 |
+
setInterval(createSnowflake, 100);
|
205 |
+
"""
|
206 |
+
with gr.Blocks(css=css) as app:
|
207 |
+
gr.HTML(f"<script>{js_code}</script>")
|
208 |
|
209 |
with gr.Column(elem_classes="container"):
|
210 |
gr.Markdown("# ๐ X-MAS LoRA", elem_classes="header")
|
|
|
226 |
elem_classes="generate-btn"
|
227 |
)
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
# ์ต์
๋ค์ ์์ฝ๋์ธ์ผ๋ก ๊ตฌ์ฑ
|
230 |
with gr.Accordion("๐จ Advanced Options", open=False, elem_classes="accordion"):
|
231 |
with gr.Group(elem_classes="parameter-box"):
|
|
|
287 |
value=example_seed
|
288 |
)
|
289 |
|
290 |
+
# ์ค๋์ค ์ปจํธ๋กค - ์ปจํ
์ด๋ ๋ฐ์ ๋ฐฐ์น
|
291 |
+
gr.HTML("""
|
292 |
+
<div class="audio-controls">
|
293 |
+
<button class="audio-btn" onclick="toggleAudio(1)">Play Music 1</button>
|
294 |
+
<button class="audio-btn" onclick="toggleAudio(2)">Play Music 2</button>
|
295 |
+
<button class="audio-btn" onclick="stopAllAudio()">Stop All</button>
|
296 |
+
</div>
|
297 |
+
<audio id="bgMusic1" loop style="display: none;">
|
298 |
+
<source src="file/1.mp3" type="audio/mp3">
|
299 |
+
</audio>
|
300 |
+
<audio id="bgMusic2" loop style="display: none;">
|
301 |
+
<source src="file/2.mp3" type="audio/mp3">
|
302 |
+
</audio>
|
303 |
+
<script>
|
304 |
+
let currentlyPlaying = null;
|
305 |
+
|
306 |
+
function toggleAudio(num) {
|
307 |
+
const audio = document.getElementById('bgMusic' + num);
|
308 |
+
const otherAudio = document.getElementById('bgMusic' + (num === 1 ? 2 : 1));
|
309 |
+
|
310 |
+
if (currentlyPlaying === audio) {
|
311 |
+
audio.pause();
|
312 |
+
currentlyPlaying = null;
|
313 |
+
} else {
|
314 |
+
if (currentlyPlaying) {
|
315 |
+
currentlyPlaying.pause();
|
316 |
+
}
|
317 |
+
otherAudio.pause();
|
318 |
+
audio.play();
|
319 |
+
currentlyPlaying = audio;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
function stopAllAudio() {
|
324 |
+
document.getElementById('bgMusic1').pause();
|
325 |
+
document.getElementById('bgMusic2').pause();
|
326 |
+
currentlyPlaying = null;
|
327 |
+
}
|
328 |
+
</script>
|
329 |
+
""")
|
330 |
+
|
331 |
app.load(
|
332 |
load_example,
|
333 |
inputs=[],
|
|
|
340 |
outputs=[result, seed]
|
341 |
)
|
342 |
|
|
|
|
|
343 |
app.queue()
|
344 |
+
app.launch()
|