Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,8 @@ def make_html_table(caption):
|
|
| 54 |
# html += '</table>'
|
| 55 |
return html
|
| 56 |
|
| 57 |
-
def infer(prompt, neg, seed, rand, w, h, cfg, steps, scheduler_type,
|
|
|
|
| 58 |
if rand:
|
| 59 |
seed = random.randint(0, MAX_SEED)
|
| 60 |
generator = torch.Generator(device=device).manual_seed(seed)
|
|
@@ -94,10 +95,6 @@ def infer(prompt, neg, seed, rand, w, h, cfg, steps, scheduler_type, progress=gr
|
|
| 94 |
tables_html = "".join(f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>' for item in history)
|
| 95 |
return img, gallery_items, tables_html
|
| 96 |
|
| 97 |
-
def add_to_history(img):
|
| 98 |
-
history.insert(0, img)
|
| 99 |
-
return history
|
| 100 |
-
|
| 101 |
# CSS 設定(ダークモード強制防止+カフェ風テーマ)
|
| 102 |
css = """
|
| 103 |
body {
|
|
@@ -261,11 +258,7 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("maki
|
|
| 261 |
run.click(
|
| 262 |
fn=infer,
|
| 263 |
inputs=[prompt, neg, seed_sl, rand, width, height, cfg, steps, scheduler_type],
|
| 264 |
-
outputs=[img_out]
|
| 265 |
-
).then(
|
| 266 |
-
fn=add_to_history,
|
| 267 |
-
inputs=[img_out],
|
| 268 |
-
outputs=[history_gallery]
|
| 269 |
)
|
| 270 |
|
| 271 |
demo.queue()
|
|
|
|
| 54 |
# html += '</table>'
|
| 55 |
return html
|
| 56 |
|
| 57 |
+
def infer(prompt, neg, seed, rand, w, h, cfg, steps, scheduler_type,
|
| 58 |
+
progress=gr.Progress(track_tqdm=True)):
|
| 59 |
if rand:
|
| 60 |
seed = random.randint(0, MAX_SEED)
|
| 61 |
generator = torch.Generator(device=device).manual_seed(seed)
|
|
|
|
| 95 |
tables_html = "".join(f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>' for item in history)
|
| 96 |
return img, gallery_items, tables_html
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
# CSS 設定(ダークモード強制防止+カフェ風テーマ)
|
| 99 |
css = """
|
| 100 |
body {
|
|
|
|
| 258 |
run.click(
|
| 259 |
fn=infer,
|
| 260 |
inputs=[prompt, neg, seed_sl, rand, width, height, cfg, steps, scheduler_type],
|
| 261 |
+
outputs=[img_out, history_gallery]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
)
|
| 263 |
|
| 264 |
demo.queue()
|