Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,6 +53,9 @@ def make_html_table(caption):
|
|
| 53 |
html += '</table>'
|
| 54 |
return html
|
| 55 |
|
|
|
|
|
|
|
|
|
|
| 56 |
def update_history(img, gallery_items):
|
| 57 |
tables_html = "".join(
|
| 58 |
f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>'
|
|
@@ -97,8 +100,7 @@ def infer(prompt, neg, seed, rand, w, h, cfg, steps, scheduler_type,
|
|
| 97 |
history.insert(0, (img, caption_text))
|
| 98 |
progress(1.0, desc="Done!")
|
| 99 |
|
| 100 |
-
|
| 101 |
-
gallery_items = [(item, make_html_table(caption)) for item in history]
|
| 102 |
tables_html = "".join(f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>' for item in history)
|
| 103 |
return img, gallery_items
|
| 104 |
|
|
@@ -286,7 +288,11 @@ window.addEventListener('load', () => {
|
|
| 286 |
</script>
|
| 287 |
"""
|
| 288 |
)
|
| 289 |
-
img_out = gr.Image(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
state = gr.State([])
|
| 291 |
history_gallery = gr.Gallery(
|
| 292 |
label="生成履歴",
|
|
|
|
| 53 |
html += '</table>'
|
| 54 |
return html
|
| 55 |
|
| 56 |
+
def create_dummy_image(width=512, height=512, alpha=0):
|
| 57 |
+
return Image.new("RGBA", (width, height), (0, 0, 0, alpha))
|
| 58 |
+
|
| 59 |
def update_history(img, gallery_items):
|
| 60 |
tables_html = "".join(
|
| 61 |
f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>'
|
|
|
|
| 100 |
history.insert(0, (img, caption_text))
|
| 101 |
progress(1.0, desc="Done!")
|
| 102 |
|
| 103 |
+
gallery_items = [(img_obj, make_html_table(raw_caption_text)) for img_obj, raw_caption_text in history]
|
|
|
|
| 104 |
tables_html = "".join(f'<div style="margin-bottom:12px">{make_html_table(item[1])}</div>' for item in history)
|
| 105 |
return img, gallery_items
|
| 106 |
|
|
|
|
| 288 |
</script>
|
| 289 |
"""
|
| 290 |
)
|
| 291 |
+
img_out = gr.Image(
|
| 292 |
+
interactive=None,
|
| 293 |
+
value=create_dummy_image(width=512, height=512, alpha=0),
|
| 294 |
+
label="生成画像"
|
| 295 |
+
)
|
| 296 |
state = gr.State([])
|
| 297 |
history_gallery = gr.Gallery(
|
| 298 |
label="生成履歴",
|