New Log System
This commit is contained in:
parent
0e1aa8d084
commit
7a6b46f363
@ -1 +1 @@
|
|||||||
version = '2.1.851'
|
version = '2.1.852'
|
||||||
|
@ -34,6 +34,7 @@ def worker():
|
|||||||
import modules.advanced_parameters as advanced_parameters
|
import modules.advanced_parameters as advanced_parameters
|
||||||
import extras.ip_adapter as ip_adapter
|
import extras.ip_adapter as ip_adapter
|
||||||
import extras.face_crop
|
import extras.face_crop
|
||||||
|
import fooocus_version
|
||||||
|
|
||||||
from modules.sdxl_styles import apply_style, apply_wildcards, fooocus_expansion
|
from modules.sdxl_styles import apply_style, apply_wildcards, fooocus_expansion
|
||||||
from modules.private_logger import log
|
from modules.private_logger import log
|
||||||
@ -492,7 +493,7 @@ def worker():
|
|||||||
|
|
||||||
if direct_return:
|
if direct_return:
|
||||||
d = [('Upscale (Fast)', '2x')]
|
d = [('Upscale (Fast)', '2x')]
|
||||||
log(uov_input_image, d, single_line_number=1)
|
log(uov_input_image, d)
|
||||||
yield_result(async_task, uov_input_image, do_not_show_finished_images=True)
|
yield_result(async_task, uov_input_image, do_not_show_finished_images=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -774,12 +775,13 @@ def worker():
|
|||||||
('Refiner Switch', refiner_switch),
|
('Refiner Switch', refiner_switch),
|
||||||
('Sampler', sampler_name),
|
('Sampler', sampler_name),
|
||||||
('Scheduler', scheduler_name),
|
('Scheduler', scheduler_name),
|
||||||
('Seed', task['task_seed'])
|
('Seed', task['task_seed']),
|
||||||
]
|
]
|
||||||
for n, w in loras:
|
for n, w in loras:
|
||||||
if n != 'None':
|
if n != 'None':
|
||||||
d.append((f'LoRA [{n}] weight', w))
|
d.append((f'LoRA', f'{n} : {w}'))
|
||||||
log(x, d, single_line_number=3)
|
d.append(('Version', 'v' + fooocus_version.version))
|
||||||
|
log(x, d)
|
||||||
|
|
||||||
yield_result(async_task, imgs, do_not_show_finished_images=len(tasks) == 1)
|
yield_result(async_task, imgs, do_not_show_finished_images=len(tasks) == 1)
|
||||||
except ldm_patched.modules.model_management.InterruptProcessingException as e:
|
except ldm_patched.modules.model_management.InterruptProcessingException as e:
|
||||||
|
@ -16,7 +16,7 @@ def get_current_html_path():
|
|||||||
return html_name
|
return html_name
|
||||||
|
|
||||||
|
|
||||||
def log(img, dic, single_line_number=3):
|
def log(img, dic):
|
||||||
if args_manager.args.disable_image_log:
|
if args_manager.args.disable_image_log:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -25,36 +25,50 @@ def log(img, dic, single_line_number=3):
|
|||||||
Image.fromarray(img).save(local_temp_filename)
|
Image.fromarray(img).save(local_temp_filename)
|
||||||
html_name = os.path.join(os.path.dirname(local_temp_filename), 'log.html')
|
html_name = os.path.join(os.path.dirname(local_temp_filename), 'log.html')
|
||||||
|
|
||||||
existing_log = log_cache.get(html_name, None)
|
css_styles = (
|
||||||
|
"<style>"
|
||||||
|
"body { background-color: #121212; color: #E0E0E0; } "
|
||||||
|
"a { color: #BB86FC; } "
|
||||||
|
".metadata { border-collapse: collapse; width: 100%; } "
|
||||||
|
".metadata .key { width: 15%; } "
|
||||||
|
".metadata .value { width: 85%; font-weight: bold; } "
|
||||||
|
".metadata th, .metadata td { border: 1px solid #4d4d4d; padding: 4px; } "
|
||||||
|
".image-container img { height: auto; max-width: 512px; display: block; padding-right:10px; } "
|
||||||
|
".image-container div { text-align: center; padding: 4px; } "
|
||||||
|
"hr { border-color: gray; } "
|
||||||
|
"</style>"
|
||||||
|
)
|
||||||
|
|
||||||
if existing_log is None:
|
begin_part = f"<html><head><title>Fooocus Log {date_string}</title>{css_styles}</head><body><p>Fooocus Log {date_string} (private)</p>\n<p>All images are clean, without any hidden data/meta, and safe to share with others.</p><!--fooocus-log-split-->\n\n"
|
||||||
|
end_part = f'\n<!--fooocus-log-split--></body></html>'
|
||||||
|
|
||||||
|
middle_part = log_cache.get(html_name, "")
|
||||||
|
|
||||||
|
if middle_part == "":
|
||||||
if os.path.exists(html_name):
|
if os.path.exists(html_name):
|
||||||
existing_log = open(html_name, encoding='utf-8').read()
|
existing_split = open(html_name, 'r', encoding='utf-8').read().split('<!--fooocus-log-split-->')
|
||||||
else:
|
if len(existing_split) == 3:
|
||||||
existing_log = f'<p>Fooocus Log {date_string} (private)</p>\n<p>All images do not contain any hidden data.</p>'
|
middle_part = existing_split[1]
|
||||||
|
else:
|
||||||
|
middle_part = existing_split[0]
|
||||||
|
|
||||||
div_name = only_name.replace('.', '_')
|
div_name = only_name.replace('.', '_')
|
||||||
item = f'<div id="{div_name}">\n'
|
item = f"<div id=\"{div_name}\" class=\"image-container\"><hr><table><tr>\n"
|
||||||
item += "<table><tr>"
|
item += f"<td><a href=\"{only_name}\" target=\"_blank\"><img src='{only_name}' onerror=\"this.closest('.image-container').style.display='none';\" loading='lazy'></img></a><div>{only_name}</div></td>"
|
||||||
item += f"<td><img src=\"{only_name}\" width=auto height=100% loading=lazy style=\"height:auto;max-width:512px\" onerror=\"document.getElementById('{div_name}').style.display = 'none';\"></img></p></td>"
|
item += "<td><table class='metadata'>"
|
||||||
item += f"<td style=\"padding-left:10px;\"><p>{only_name}</p>\n"
|
for key, value in dic:
|
||||||
for i, (k, v) in enumerate(dic):
|
item += f"<tr><td class='key'>{key}</td><td class='value'>{value}</td></tr>\n"
|
||||||
if i < single_line_number:
|
item += "</table>"
|
||||||
item += f"<p>{k}: <b>{v}</b></p>\n"
|
|
||||||
else:
|
|
||||||
if (i - single_line_number) % 2 == 0:
|
|
||||||
item += f"<p>{k}: <b>{v}</b>, "
|
|
||||||
else:
|
|
||||||
item += f"{k}: <b>{v}</b></p>\n"
|
|
||||||
item += "</td>"
|
item += "</td>"
|
||||||
item += "</tr></table><hr></div>\n"
|
item += "</tr></table></div>\n\n"
|
||||||
existing_log = item + existing_log
|
|
||||||
|
middle_part = item + middle_part
|
||||||
|
|
||||||
with open(html_name, 'w', encoding='utf-8') as f:
|
with open(html_name, 'w', encoding='utf-8') as f:
|
||||||
f.write(existing_log)
|
f.write(begin_part + middle_part + end_part)
|
||||||
|
|
||||||
print(f'Image generated with private log at: {html_name}')
|
print(f'Image generated with private log at: {html_name}')
|
||||||
|
|
||||||
log_cache[html_name] = existing_log
|
log_cache[html_name] = middle_part
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# 2.1.852
|
||||||
|
|
||||||
|
* New Log System: Log system now uses tables. If this is breaking some other browser extension or javascript developments, see also [use previous version](https://github.com/lllyasviel/Fooocus/discussions/1405).
|
||||||
|
|
||||||
# 2.1.846
|
# 2.1.846
|
||||||
|
|
||||||
* Many users reported that image quality is different from 2.1.824. We reviewed all codes and fixed several precision problems in 2.1.846.
|
* Many users reported that image quality is different from 2.1.824. We reviewed all codes and fixed several precision problems in 2.1.846.
|
||||||
|
Loading…
Reference in New Issue
Block a user