mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
fix ui dummy comp
This commit is contained in:
+4
-2
@@ -33,8 +33,10 @@ And it also includes fixes for all reported issues so far
|
||||
- enable vae tiling
|
||||
- add autodetect optimial value
|
||||
set tile size to 0 to use autodetected value
|
||||
- **cli**: sdapi.py allow manual api invoke
|
||||
example: `python cli/sdapi.py /sdapi/v1/sd-models`
|
||||
- **cli**:
|
||||
- `sdapi.py` allow manual api invoke
|
||||
example: `python cli/sdapi.py /sdapi/v1/sd-models`
|
||||
- `image-exif.py` improve metadata parsing
|
||||
- **memory**: add ram usage monitoring in addition to gpu memory usage monitoring
|
||||
- **vae**: enable taesd batch decode
|
||||
enable/disable with settings -> diffusers > vae slicing
|
||||
|
||||
+35
-8
@@ -4,12 +4,9 @@ import os
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
import json
|
||||
from PIL import Image, ExifTags, TiffImagePlugin, PngImagePlugin
|
||||
from rich import print # pylint: disable=redefined-builtin
|
||||
|
||||
# warnings.filterwarnings("ignore", category=UserWarning)
|
||||
|
||||
|
||||
class Exif: # pylint: disable=single-string-used-for-slots
|
||||
__slots__ = ('__dict__') # pylint: disable=superfluous-parens
|
||||
@@ -69,6 +66,36 @@ class Exif: # pylint: disable=single-string-used-for-slots
|
||||
pass
|
||||
return None
|
||||
|
||||
def parse(self):
|
||||
re_param_code = r'\s*([\w ]+):\s*("(?:\\"[^,]|\\"|\\|[^\"])+"|[^,]*)(?:,|$)'
|
||||
re_param = re.compile(re_param_code)
|
||||
x = self.exif.pop('parameters', None) or self.exif.pop('UserComment', None)
|
||||
res = {}
|
||||
if x is None:
|
||||
return res
|
||||
remaining = x.replace('\n', ' ').strip()
|
||||
if len(remaining) == 0:
|
||||
return res
|
||||
remaining = x[7:] if x.startswith('Prompt: ') else x
|
||||
remaining = x[11:] if x.startswith('parameters: ') else x
|
||||
if 'Steps: ' in remaining and 'Negative prompt: ' not in remaining:
|
||||
remaining = remaining.replace('Steps: ', 'Negative prompt: Steps: ')
|
||||
prompt, remaining = remaining.strip().split('Negative prompt: ', maxsplit=1) if 'Negative prompt: ' in remaining else (remaining, '')
|
||||
res["Prompt"] = prompt.strip()
|
||||
negative, remaining = remaining.strip().split('Steps: ', maxsplit=1) if 'Steps: ' in remaining else (remaining, None)
|
||||
res["Negative prompt"] = negative.strip()
|
||||
if remaining is None:
|
||||
return res
|
||||
remaining = f'Steps: {remaining}'
|
||||
for k, v in re_param.findall(remaining.strip()):
|
||||
if v.isdigit():
|
||||
res[k] = float(v) if '.' in v else int(v)
|
||||
else:
|
||||
res[k] = v
|
||||
from types import SimpleNamespace
|
||||
ns = SimpleNamespace(**res)
|
||||
return ns
|
||||
|
||||
def get_bytes(self):
|
||||
ifd = TiffImagePlugin.ImageFileDirectory_v2()
|
||||
exif_stream = io.BytesIO()
|
||||
@@ -87,13 +114,13 @@ def read_exif(filename: str):
|
||||
from pi_heif import register_heif_opener
|
||||
register_heif_opener()
|
||||
try:
|
||||
img = Image.open(filename)
|
||||
exif = Exif(img)
|
||||
print('image:', filename, 'format:', img.format, 'metadata:', json.dumps(vars(exif.exif)['_data'], indent=2))
|
||||
image = Image.open(filename)
|
||||
exif = Exif(image)
|
||||
print('image:', filename, 'format:', image)
|
||||
print('exif:', vars(exif.exif)['_data'])
|
||||
print('info:', exif.parse())
|
||||
except Exception as e:
|
||||
print('metadata error reading:', filename, e)
|
||||
# exif.exif['Software'] = 'This is a Test'
|
||||
# img.save('input-scored.jpg', exif=exif.bytes())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Submodule extensions-builtin/sd-webui-controlnet updated: 8bd8057cca...e3fe75268e
+1
-1
Submodule modules/lora updated: 1a36f9dc65...4f93bf10f0
+1
-1
@@ -228,7 +228,7 @@ def create_ui(startup_timer = None):
|
||||
def run_settings(*args):
|
||||
changed = []
|
||||
for key, value, comp in zip(opts.data_labels.keys(), args, components):
|
||||
if comp == dummy_component:
|
||||
if comp == dummy_component or value=='dummy':
|
||||
continue
|
||||
if not opts.same_type(value, opts.data_labels[key].default):
|
||||
log.error(f'Setting bad value: {key}={value} expecting={type(opts.data_labels[key].default).__name__}')
|
||||
|
||||
@@ -144,7 +144,8 @@ def create_ui():
|
||||
|
||||
cfg_scale, clip_skip, image_cfg_scale, diffusers_guidance_rescale, sag_scale, full_quality, restore_faces, tiling, hdr_clamp, hdr_boundary, hdr_threshold, hdr_center, hdr_channel_shift, hdr_full_shift, hdr_maximize, hdr_max_center, hdr_max_boundry = ui_sections.create_advanced_inputs('img2img')
|
||||
|
||||
with FormGroup(elem_id="inpaint_controls", visible=False) as inpaint_controls:
|
||||
# with FormGroup(elem_id="inpaint_controls", visible=False) as inpaint_controls:
|
||||
with gr.Accordion(open=True, label="Mask", elem_classes=["small-accordion"], elem_id="img2img_mask_group") as inpaint_controls:
|
||||
with FormRow():
|
||||
mask_blur = gr.Slider(label='Mask blur', minimum=0, maximum=64, step=1, value=4, elem_id="img2img_mask_blur")
|
||||
mask_alpha = gr.Slider(label="Mask transparency", visible=False, elem_id="img2img_mask_alpha")
|
||||
|
||||
Reference in New Issue
Block a user