Spaces:
Sleeping
Sleeping
gpt
Browse files
app.py
CHANGED
|
@@ -138,23 +138,23 @@ html, .gradio-container, .dark, .dark * {
|
|
| 138 |
font-weight: bold;
|
| 139 |
margin: 12px 0;
|
| 140 |
}
|
| 141 |
-
.block.svelte-11xb1hd{
|
| 142 |
-
background
|
| 143 |
}
|
| 144 |
-
.span.svelte-g2oxp3, label.svelte-5ncdh7.svelte-5ncdh7.svelte-5ncdh7{
|
| 145 |
color: #915325 !important;
|
| 146 |
}
|
| 147 |
-
.svelte-zyxd38 g{
|
| 148 |
-
|
| 149 |
}
|
| 150 |
-
.secondary.svelte-1ixn6qd{
|
| 151 |
background: #dca08a !important;
|
| 152 |
color: #631c00 !important;
|
| 153 |
}
|
| 154 |
-
:root{
|
| 155 |
--color-accent: #a57659;
|
| 156 |
}
|
| 157 |
-
.max_value.svelte-10lj3xl.svelte-10lj3xl{
|
| 158 |
color: #a54618 !important;
|
| 159 |
}
|
| 160 |
body.gradio-running #custom-loader { display: flex; }
|
|
@@ -172,61 +172,20 @@ body.gradio-running #custom-loader { display: flex; }
|
|
| 172 |
border-radius: 50%;
|
| 173 |
margin-left: 8px;
|
| 174 |
}
|
| 175 |
-
.nobackground, .nobackground div{
|
| 176 |
background-color: transparent !important;
|
| 177 |
}
|
| 178 |
"""
|
| 179 |
-
with gr.Blocks(css=css) as demo:
|
| 180 |
-
loader = gr.HTML(
|
| 181 |
-
"""
|
| 182 |
-
<div id="custom-loader" style="display:none;align-items:center;justify-content:center;font-weight:bold;margin:12px 0;">
|
| 183 |
-
<div class="loading-text">
|
| 184 |
-
<span style="animation-delay:0s">i</span>
|
| 185 |
-
<span style="animation-delay:0.1s">n</span>
|
| 186 |
-
<span style="animation-delay:0.2s"> </span>
|
| 187 |
-
<span style="animation-delay:0.3s">p</span>
|
| 188 |
-
<span style="animation-delay:0.4s">r</span>
|
| 189 |
-
<span style="animation-delay:0.5s">o</span>
|
| 190 |
-
<span style="animation-delay:0.6s">g</span>
|
| 191 |
-
<span style="animation-delay:0.7s">r</span>
|
| 192 |
-
<span style="animation-delay:0.8s">e</span>
|
| 193 |
-
<span style="animation-delay:0.9s">s</span>
|
| 194 |
-
<span style="animation-delay:1.0s">s</span>
|
| 195 |
-
</div>
|
| 196 |
-
<img src="icon.png" alt="loading icon" style="width:32px;height:32px;border-radius:50%;margin-left:8px;" />
|
| 197 |
-
</div>
|
| 198 |
-
<script>
|
| 199 |
-
(()=>{
|
| 200 |
-
// 1) SVG 要素を探す
|
| 201 |
-
const targetSvg = document.querySelector('svg.svelte-zyxd38');
|
| 202 |
-
const loaderEl = document.getElementById('custom-loader');
|
| 203 |
-
if (!targetSvg || !loaderEl) return;
|
| 204 |
-
|
| 205 |
-
// 2) SVG の直後にローダーを移動
|
| 206 |
-
targetSvg.parentNode.insertBefore(loaderEl, targetSvg.nextSibling);
|
| 207 |
-
|
| 208 |
-
// 3) SVG の存在を監視(属性変化でも再表示を制御可)
|
| 209 |
-
const mo = new MutationObserver(() => {
|
| 210 |
-
// SVG が DOM 内にあるか?
|
| 211 |
-
const stillThere = document.contains(targetSvg);
|
| 212 |
-
loaderEl.style.display = stillThere ? 'flex' : 'none';
|
| 213 |
-
});
|
| 214 |
-
mo.observe(document.body, { childList: true, subtree: true });
|
| 215 |
|
| 216 |
-
|
| 217 |
-
loaderEl.style.display = 'flex';
|
| 218 |
-
})();
|
| 219 |
-
</script>
|
| 220 |
-
"""
|
| 221 |
-
)
|
| 222 |
-
|
| 223 |
with gr.Column(elem_id="col-container"):
|
| 224 |
-
|
| 225 |
-
gr.Markdown('<section class="nobackground"
|
|
|
|
| 226 |
|
| 227 |
with gr.Row():
|
| 228 |
prompt = gr.Textbox(lines=1, placeholder="Prompt…", value="1girl, cocoart, masterpiece, anime,", label="Prompt")
|
| 229 |
-
neg
|
| 230 |
with gr.Row():
|
| 231 |
seed_sl = gr.Slider(0, MAX_SEED, step=1, value=0, label="Seed")
|
| 232 |
rand = gr.Checkbox(True, label="Randomize seed")
|
|
@@ -240,6 +199,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 240 |
scheduler_type = gr.Radio(choices=["Euler Ancestral", "DPM++ 2M SDE"], value="Euler Ancestral", label="Scheduler")
|
| 241 |
run = gr.Button("Generate")
|
| 242 |
|
|
|
|
| 243 |
loader = gr.HTML(
|
| 244 |
'<div id="custom-loader">'
|
| 245 |
' <div class="loading-text">'
|
|
@@ -261,7 +221,14 @@ with gr.Blocks(css=css) as demo:
|
|
| 261 |
|
| 262 |
img_out = gr.Image()
|
| 263 |
state = gr.State([])
|
| 264 |
-
history_gallery = gr.Gallery(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
run.click(
|
| 267 |
fn=infer,
|
|
|
|
| 138 |
font-weight: bold;
|
| 139 |
margin: 12px 0;
|
| 140 |
}
|
| 141 |
+
.block.svelte-11xb1hd {
|
| 142 |
+
background: #efd1bf !important;
|
| 143 |
}
|
| 144 |
+
.span.svelte-g2oxp3, label.svelte-5ncdh7.svelte-5ncdh7.svelte-5ncdh7 {
|
| 145 |
color: #915325 !important;
|
| 146 |
}
|
| 147 |
+
.svelte-zyxd38 g {
|
| 148 |
+
display: none !important;
|
| 149 |
}
|
| 150 |
+
.secondary.svelte-1ixn6qd {
|
| 151 |
background: #dca08a !important;
|
| 152 |
color: #631c00 !important;
|
| 153 |
}
|
| 154 |
+
:root {
|
| 155 |
--color-accent: #a57659;
|
| 156 |
}
|
| 157 |
+
.max_value.svelte-10lj3xl.svelte-10lj3xl {
|
| 158 |
color: #a54618 !important;
|
| 159 |
}
|
| 160 |
body.gradio-running #custom-loader { display: flex; }
|
|
|
|
| 172 |
border-radius: 50%;
|
| 173 |
margin-left: 8px;
|
| 174 |
}
|
| 175 |
+
.nobackground, .nobackground div {
|
| 176 |
background-color: transparent !important;
|
| 177 |
}
|
| 178 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
+
with gr.Blocks(css=css) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
with gr.Column(elem_id="col-container"):
|
| 182 |
+
# 元のまま:section.nobackground で囲むことでデザイン崩れなし
|
| 183 |
+
gr.Markdown('<section class="nobackground">## SDXL Base – cocoamixXL3 Demo</section>')
|
| 184 |
+
gr.Markdown('<section class="nobackground">[Link: Civitai](https://civitai.com/models/1553716?modelVersionId=1855218)</section>')
|
| 185 |
|
| 186 |
with gr.Row():
|
| 187 |
prompt = gr.Textbox(lines=1, placeholder="Prompt…", value="1girl, cocoart, masterpiece, anime,", label="Prompt")
|
| 188 |
+
neg = gr.Textbox(lines=1, placeholder="Negative prompt", value="low quality, worst quality, bad shadow, lowres, error, miss stroke, sketch art, smoke, ugly, extra digits, creepy, imprecise, glowing blur,", label="Negative prompt")
|
| 189 |
with gr.Row():
|
| 190 |
seed_sl = gr.Slider(0, MAX_SEED, step=1, value=0, label="Seed")
|
| 191 |
rand = gr.Checkbox(True, label="Randomize seed")
|
|
|
|
| 199 |
scheduler_type = gr.Radio(choices=["Euler Ancestral", "DPM++ 2M SDE"], value="Euler Ancestral", label="Scheduler")
|
| 200 |
run = gr.Button("Generate")
|
| 201 |
|
| 202 |
+
# カスタムローダー(ボタン直下に一度だけ)
|
| 203 |
loader = gr.HTML(
|
| 204 |
'<div id="custom-loader">'
|
| 205 |
' <div class="loading-text">'
|
|
|
|
| 221 |
|
| 222 |
img_out = gr.Image()
|
| 223 |
state = gr.State([])
|
| 224 |
+
history_gallery = gr.Gallery(
|
| 225 |
+
label="生成履歴",
|
| 226 |
+
columns=4,
|
| 227 |
+
height=280,
|
| 228 |
+
show_label=False,
|
| 229 |
+
interactive=True,
|
| 230 |
+
type="auto"
|
| 231 |
+
)
|
| 232 |
|
| 233 |
run.click(
|
| 234 |
fn=infer,
|