From 4e8dfa3af5ece296200abce7ff08f85bfe8c0dc1 Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Mon, 22 Apr 2024 00:54:16 -0600 Subject: [PATCH] Make gallery return images --- modules/ui_common.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/ui_common.py b/modules/ui_common.py index 641420ca9..5dbe9579d 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -5,7 +5,6 @@ import html import os import gradio as gr -from PIL import Image from modules import call_queue, shared, ui_tempdir, util import modules.images @@ -113,10 +112,8 @@ def save_files(js_data, images, do_make_zip, index): writer.writerow(fields) for image_index, filedata in enumerate(images, start_index): - image = Image.open(filedata[0]) - + image = filedata[0] is_grid = image_index < p.index_of_first_image - p.batch_index = image_index-1 parameters = parameters_copypaste.parse_generation_parameters(data["infotexts"][image_index], []) @@ -181,7 +178,7 @@ def create_output_panel(tabname, outdir, toprow=None): with gr.Column(variant='panel', elem_id=f"{tabname}_results_panel"): with gr.Group(elem_id=f"{tabname}_gallery_container"): - res.gallery = gr.Gallery(label='Output', show_label=False, elem_id=f"{tabname}_gallery", columns=4, preview=True, height=shared.opts.gallery_height or None, interactive=False) + res.gallery = gr.Gallery(label='Output', show_label=False, elem_id=f"{tabname}_gallery", columns=4, preview=True, height=shared.opts.gallery_height or None, interactive=False, type="pil") with gr.Row(elem_id=f"image_buttons_{tabname}", elem_classes="image-buttons"): open_folder_button = ToolButton(folder_symbol, elem_id=f'{tabname}_open_folder', visible=not shared.cmd_opts.hide_ui_dir_config, tooltip="Open images output directory.")