Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -139,7 +139,9 @@ html, .gradio-container, .dark, .dark * {
|
|
| 139 |
justify-content: center;
|
| 140 |
font-weight: bold;
|
| 141 |
margin: 12px 0;
|
| 142 |
-
position: fixed;
|
|
|
|
|
|
|
| 143 |
}
|
| 144 |
.block.svelte-11xb1hd {
|
| 145 |
background: #efd1bf !important;
|
|
@@ -175,7 +177,7 @@ body.gradio-running #custom-loader { display: flex; }
|
|
| 175 |
border-radius: 50%;
|
| 176 |
margin-left: 8px;
|
| 177 |
}
|
| 178 |
-
.nobackground, .nobackground div, .nobackground.parent.parent {
|
| 179 |
background-color: transparent !important;
|
| 180 |
}
|
| 181 |
"""
|
|
@@ -225,14 +227,15 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("maki
|
|
| 225 |
<script>
|
| 226 |
window.addEventListener('load', () => {
|
| 227 |
const loaderEl = document.getElementById('custom-loader');
|
| 228 |
-
const mo = new MutationObserver(() => {
|
| 229 |
const svg = document.querySelector('svg.svelte-zyxd38');
|
| 230 |
if (!svg || !loaderEl) return;
|
| 231 |
-
// loader
|
| 232 |
if (!svg.contains(loaderEl)) {
|
| 233 |
svg.appendChild(loaderEl);
|
| 234 |
}
|
| 235 |
});
|
|
|
|
| 236 |
mo.observe(document.body, { childList: true, subtree: true });
|
| 237 |
});
|
| 238 |
</script>
|
|
@@ -255,13 +258,7 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("maki
|
|
| 255 |
fn=infer,
|
| 256 |
inputs=[prompt, neg, seed_sl, rand, width, height, cfg, steps, scheduler_type],
|
| 257 |
outputs=[img_out]
|
| 258 |
-
)
|
| 259 |
-
|
| 260 |
-
def add_to_history(img):
|
| 261 |
-
history.insert(0, img)
|
| 262 |
-
return history
|
| 263 |
-
|
| 264 |
-
run.click(
|
| 265 |
fn=add_to_history,
|
| 266 |
inputs=[img_out],
|
| 267 |
outputs=[history_gallery]
|
|
|
|
| 139 |
justify-content: center;
|
| 140 |
font-weight: bold;
|
| 141 |
margin: 12px 0;
|
| 142 |
+
position: fixed;
|
| 143 |
+
z-index: 9999;
|
| 144 |
+
|
| 145 |
}
|
| 146 |
.block.svelte-11xb1hd {
|
| 147 |
background: #efd1bf !important;
|
|
|
|
| 177 |
border-radius: 50%;
|
| 178 |
margin-left: 8px;
|
| 179 |
}
|
| 180 |
+
.nobackground, .nobackground div, .nobackground.parent.parent.parent {
|
| 181 |
background-color: transparent !important;
|
| 182 |
}
|
| 183 |
"""
|
|
|
|
| 227 |
<script>
|
| 228 |
window.addEventListener('load', () => {
|
| 229 |
const loaderEl = document.getElementById('custom-loader');
|
| 230 |
+
const mo = new MutationObserver((mutations) => {
|
| 231 |
const svg = document.querySelector('svg.svelte-zyxd38');
|
| 232 |
if (!svg || !loaderEl) return;
|
| 233 |
+
// loader が SVG 内にない場合は再アタッチ
|
| 234 |
if (!svg.contains(loaderEl)) {
|
| 235 |
svg.appendChild(loaderEl);
|
| 236 |
}
|
| 237 |
});
|
| 238 |
+
// childList: 子の追加/削除、subtree: 再描画で中身クリア→追加されるのを検知
|
| 239 |
mo.observe(document.body, { childList: true, subtree: true });
|
| 240 |
});
|
| 241 |
</script>
|
|
|
|
| 258 |
fn=infer,
|
| 259 |
inputs=[prompt, neg, seed_sl, rand, width, height, cfg, steps, scheduler_type],
|
| 260 |
outputs=[img_out]
|
| 261 |
+
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
fn=add_to_history,
|
| 263 |
inputs=[img_out],
|
| 264 |
outputs=[history_gallery]
|