Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -224,6 +224,43 @@ title_html="""
|
|
224 |
<h1 id="title-text">FLUX Capacitor</h1>
|
225 |
</div>
|
226 |
</center>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
"""
|
228 |
|
229 |
css = """
|
@@ -296,32 +333,7 @@ css = """
|
|
296 |
|
297 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
298 |
|
299 |
-
|
300 |
-
const accordion = document.querySelector('.gradio-accordion');
|
301 |
-
const container = document.querySelector('.gradio-container');
|
302 |
-
|
303 |
-
function adjustBackground() {
|
304 |
-
if (accordion && accordion.classList.contains('open')) {
|
305 |
-
container.style.backgroundSize = '900px 2100px'; // When accordion is open
|
306 |
-
} else {
|
307 |
-
container.style.backgroundSize = '900px 880px'; // When accordion is closed
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
// Initial background size based on initial state
|
312 |
-
adjustBackground();
|
313 |
-
|
314 |
-
// Use MutationObserver to watch for changes in the accordion's class
|
315 |
-
const observer = new MutationObserver((mutations) => {
|
316 |
-
mutations.forEach((mutation) => {
|
317 |
-
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
318 |
-
adjustBackground();
|
319 |
-
}
|
320 |
-
});
|
321 |
-
});
|
322 |
-
|
323 |
-
observer.observe(accordion, { attributes: true });
|
324 |
-
""")
|
325 |
|
326 |
gr.HTML(title_html) # title html
|
327 |
|
|
|
224 |
<h1 id="title-text">FLUX Capacitor</h1>
|
225 |
</div>
|
226 |
</center>
|
227 |
+
|
228 |
+
<script>
|
229 |
+
function gradioApp() {
|
230 |
+
const gradioShadowRoot = document.getElementsByTagName('gradio-app')[0].shadowRoot;
|
231 |
+
return gradioShadowRoot.getElementById('component-0') || document;
|
232 |
+
}
|
233 |
+
|
234 |
+
function adjustBackground() {
|
235 |
+
const accordion = gradioApp().querySelector('.gradio-accordion');
|
236 |
+
const container = gradioApp().querySelector('.gradio-container');
|
237 |
+
|
238 |
+
if (accordion && accordion.classList.contains('open')) {
|
239 |
+
container.style.backgroundSize = '900px 2100px'; // When accordion is open
|
240 |
+
} else {
|
241 |
+
container.style.backgroundSize = '900px 880px'; // When accordion is closed
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
// Initial background size based on initial state
|
246 |
+
document.addEventListener('DOMContentLoaded', () => {
|
247 |
+
adjustBackground();
|
248 |
+
|
249 |
+
// Use MutationObserver to watch for changes in the accordion's class
|
250 |
+
const observer = new MutationObserver((mutations) => {
|
251 |
+
mutations.forEach((mutation) => {
|
252 |
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
253 |
+
adjustBackground();
|
254 |
+
}
|
255 |
+
});
|
256 |
+
});
|
257 |
+
|
258 |
+
const accordion = gradioApp().querySelector('.gradio-accordion');
|
259 |
+
if (accordion) {
|
260 |
+
observer.observe(accordion, { attributes: true });
|
261 |
+
}
|
262 |
+
});
|
263 |
+
</script>
|
264 |
"""
|
265 |
|
266 |
css = """
|
|
|
333 |
|
334 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
335 |
|
336 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
gr.HTML(title_html) # title html
|
339 |
|