diff --git a/installer.py b/installer.py
index 77af023bc..d1efc24dd 100644
--- a/installer.py
+++ b/installer.py
@@ -659,7 +659,7 @@ def run_setup():
if errors == 0:
log.debug(f'Setup complete without errors: {round(time.time())}')
else:
- log.warning(f'Setup complete with errors ({errors})')
+ log.warning(f'Setup complete with errors: {errors}')
log.warning('See log file for more details: setup.log')
diff --git a/javascript/black-orange.css b/javascript/black-orange.css
index aaebb6409..c56449cc1 100644
--- a/javascript/black-orange.css
+++ b/javascript/black-orange.css
@@ -90,7 +90,7 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txt2img_cfg_scale { min-width: 200px; }
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
-#txt2img_gallery, #img2img_gallery, #extras_gallery { background: black !important; padding: 0; margin: 0; object-fit: contain; box-shadow: none; min-height: 0; height: 45vh; }
+#txt2img_gallery, #img2img_gallery, #extras_gallery { background: black !important; padding: 0; margin: 0; object-fit: contain; box-shadow: none; min-height: 0; }
#txt2img_generate, #img2img_generate { height: 36px; border: none; border-radius: 0; min-height: 36px; padding: 0; }
#txt2img_interrupt, #img2img_interrupt, #txt2img_skip, #img2img_skip { height: 36px; min-width: 116px; max-width: 116px; border: none; border-radius: 0; background-color: var(--inactive-color); margin-top: 46px; display: block !important; padding: 0; }
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
diff --git a/modules/extras.py b/modules/extras.py
index 7be84ce38..04f921a32 100644
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -19,7 +19,8 @@ def run_pnginfo(image):
items = {**{'parameters': geninfo}, **items}
info = ''
for key, text in items.items():
- info += f"
{html.escape(str(key))}: {html.escape(str(text))}
"
+ if key != 'UserComment':
+ info += f"{html.escape(str(key))}: {html.escape(str(text))}
"
if len(info) == 0:
message = "Nothing found in the image."
info = f""
diff --git a/modules/generation_parameters_copypaste.py b/modules/generation_parameters_copypaste.py
index f9c141c82..11fb321f6 100644
--- a/modules/generation_parameters_copypaste.py
+++ b/modules/generation_parameters_copypaste.py
@@ -6,7 +6,7 @@ import re
from PIL import Image
import gradio as gr
from modules.paths import data_path
-from modules import shared, ui_tempdir, script_callbacks
+from modules import shared, ui_tempdir, script_callbacks, images
re_param_code = r'\s*([\w ]+):\s*("(?:\\"[^,]|\\"|\\|[^\"])+"|[^,]*)(?:,|$)'
re_param = re.compile(re_param_code)
@@ -51,7 +51,10 @@ def image_from_url_text(filedata):
filename = filedata["name"]
is_in_right_dir = ui_tempdir.check_tmp_file(shared.demo, filename)
if is_in_right_dir:
- return Image.open(filename)
+ image = Image.open(filename)
+ geninfo, _items = images.read_info_from_image(image)
+ image.info['parameters'] = geninfo
+ return image
else:
shared.log.warning(f'File access denied: {filename}')
return None
@@ -70,6 +73,7 @@ def image_from_url_text(filedata):
filedata = filedata[len("data:image/jpeg;base64,"):]
filedata = base64.decodebytes(filedata.encode('utf-8'))
image = Image.open(io.BytesIO(filedata))
+ images.read_info_from_image(image)
return image
diff --git a/modules/images.py b/modules/images.py
index 83563b2ae..b407ef9cf 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -14,7 +14,7 @@ import numpy as np
import piexif
import piexif.helper
from PIL import Image, ImageFont, ImageDraw, PngImagePlugin, ExifTags
-from modules import sd_samplers, shared, script_callbacks, errors
+from modules import sd_samplers, shared, script_callbacks, errors, paths
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
@@ -449,9 +449,11 @@ def atomically_save_image():
if shared.opts.save_txt and len(exifinfo_data) > 0:
with open(txt_fullfn, "w", encoding="utf8") as file:
file.write(exifinfo_data + "\n")
+ with open(os.path.join(paths.data_path, "params.txt"), "w", encoding="utf8") as file:
+ file.write(exifinfo_data)
if shared.opts.save_log_fn != '' and len(exifinfo_data) > 0:
try:
- with open(shared.opts.save_log_fn, mode='a+', encoding='utf-8') as f:
+ with open(os.path.join(paths.data_path, shared.opts.save_log_fn), mode='a+', encoding='utf-8') as f:
try:
entries = json.load(f)
except:
@@ -582,7 +584,11 @@ def safe_decode_string(s: bytes):
def read_info_from_image(image):
items = image.info or {}
geninfo = items.pop('parameters', None)
+ if geninfo is None:
+ geninfo = items.pop('UserComment', None)
if geninfo is not None and len(geninfo) > 0:
+ if 'UserComment' in geninfo:
+ geninfo = geninfo['UserComment']
items['UserComment'] = geninfo
if "exif" in items:
@@ -595,9 +601,11 @@ def read_info_from_image(image):
if isinstance(val, tuple) and isinstance(val[0], int) and isinstance(val[1], int): # convert camera ratios
val = round(val[0] / val[1], 2)
if val is not None and key in ExifTags.TAGS: # add known tags
- items[ExifTags.TAGS[key]] = val
if ExifTags.TAGS[key] == 'UserComment': # add geninfo from UserComment
geninfo = val
+ items['parameters'] = val
+ else:
+ items[ExifTags.TAGS[key]] = val
elif val is not None and key in ExifTags.GPSTAGS:
items[ExifTags.GPSTAGS[key]] = val
@@ -617,7 +625,6 @@ Negative prompt: {json_info["uc"]}
Steps: {json_info["steps"]}, Sampler: {sampler}, CFG scale: {json_info["scale"]}, Seed: {json_info["seed"]}, Size: {image.width}x{image.height}, Clip skip: 2, ENSD: 31337"""
except Exception as e:
errors.display(e, 'novelai image parser')
-
return geninfo, items
diff --git a/modules/ui_common.py b/modules/ui_common.py
index a7d4601e2..5f51f9bf2 100644
--- a/modules/ui_common.py
+++ b/modules/ui_common.py
@@ -111,8 +111,8 @@ def create_output_panel(tabname, outdir):
open_folder_button = gr.Button('show', visible=not shared.cmd_opts.hide_ui_dir_config)
if tabname != "extras":
- save = gr.Button('Save', elem_id=f'save_{tabname}')
- save_zip = gr.Button('Zip', elem_id=f'save_zip_{tabname}')
+ save = gr.Button('save', elem_id=f'save_{tabname}')
+ save_zip = gr.Button('zip', elem_id=f'save_zip_{tabname}')
buttons = parameters_copypaste.create_buttons(["img2img", "inpaint", "extras"])
diff --git a/modules/ui_postprocessing.py b/modules/ui_postprocessing.py
index 80c5d940e..66b871144 100644
--- a/modules/ui_postprocessing.py
+++ b/modules/ui_postprocessing.py
@@ -4,6 +4,14 @@ import modules.generation_parameters_copypaste as parameters_copypaste
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, wrap_gradio_call # pylint: disable=unused-import
from modules.extras import run_pnginfo
+
+def submit_click(tab_index, extras_image, image_batch, extras_batch_input_dir, extras_batch_output_dir, show_extras_results, *script_inputs):
+ result_images, html_info_x, html_info = postprocessing.run_postprocessing(tab_index, extras_image, image_batch, extras_batch_input_dir, extras_batch_output_dir, show_extras_results, *script_inputs)
+ if result_images is not None and len(result_images) > 0:
+ _html_info, _generation_info, html_info_x = run_pnginfo(result_images[0])
+ return result_images, html_info_x, html_info
+
+
def create_ui():
tab_index = gr.State(value=0) # pylint: disable=abstract-class-instantiated
@@ -63,7 +71,7 @@ def create_ui():
)
submit.click(
- fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing, extra_outputs=[None, '']),
+ fn=call_queue.wrap_gradio_gpu_call(submit_click, extra_outputs=[None, '']),
inputs=[
tab_index,
extras_image,