diff --git a/CHANGELOG.md b/CHANGELOG.md index 4af643cd4..540075581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Upgrades are still possible and supported, but above is recommended for best exp main ui now has a single button on each en to trigger details view - details view includes model/lora metadata parser! - details view includes civitai model metadata! + - styles can be edited in details view - faster search, ability to show/hide/sort networks - refactored subfolder handling *note*: this will trigger model hash recaclulation on first model use @@ -42,6 +43,7 @@ Upgrades are still possible and supported, but above is recommended for best exp - `stabilityai/stable-diffusion-x4-upscaler` *(1.7GB)* - better **TI embeddings** support for SD and SDXL faster loading, wider compatibility and support for embeddings with multiple vectors + information about used embedding is now also added to image metadata - **Upscalers**: - more high quality upscalers available by default *SwinIR:2, ESRGAN:12, RealESRGAN:6, SCUNet:2* diff --git a/installer.py b/installer.py index 0c8d0a4bf..a97bbebfe 100644 --- a/installer.py +++ b/installer.py @@ -527,7 +527,7 @@ def install_packages(): install('pi-heif', 'pi_heif', ignore=True) tensorflow_package = os.environ.get('TENSORFLOW_PACKAGE', 'tensorflow==2.13.0') install(tensorflow_package, 'tensorflow', ignore=True) - install('git+https://github.com/google-research/torchsde', 'torchsde', ignore=True) + # install('git+https://github.com/google-research/torchsde', 'torchsde', ignore=True) bitsandbytes_package = os.environ.get('BITSANDBYTES_PACKAGE', None) if bitsandbytes_package is not None: install(bitsandbytes_package, 'bitsandbytes', ignore=True) diff --git a/modules/styles.py b/modules/styles.py index f23c99c01..d8a3315fd 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -9,8 +9,9 @@ from modules import paths class Style(): - def __init__(self, name: str, prompt: str = "", negative_prompt: str = "", extra: str = "", filename: str = "", preview: str = ""): + def __init__(self, name: str, desc: str = "", prompt: str = "", negative_prompt: str = "", extra: str = "", filename: str = "", preview: str = ""): self.name = name + self.description = desc self.prompt = prompt self.negative_prompt = negative_prompt self.extra = extra @@ -64,11 +65,22 @@ class StyleDatabase: if os.path.isfile(fn) and fn.lower().endswith(".json"): with open(fn, 'r', encoding='utf-8') as f: try: - style = json.load(f) - basename = os.path.splitext(os.path.basename(fn))[0] - name = re.sub(r'[\t\r\n]', '', style.get("name", basename)).strip() - name = os.path.join(os.path.dirname(os.path.relpath(fn, self.path)), name) - self.styles[style["name"]] = Style(name=name, prompt=style.get("prompt", ""), negative_prompt=style.get("negative", ""), extra=style.get("extra", ""), filename=fn, preview=style.get("preview", "")) + all_styles = json.load(f) + if type(all_styles) is dict: + all_styles = [all_styles] + for style in all_styles: + basename = os.path.splitext(os.path.basename(fn))[0] + name = re.sub(r'[\t\r\n]', '', style.get("name", basename)).strip() + name = os.path.join(os.path.dirname(os.path.relpath(fn, self.path)), name) + self.styles[style["name"]] = Style( + name=name, + desc=style.get('description', name), + prompt=style.get("prompt", ""), + negative_prompt=style.get("negative", ""), + extra=style.get("extra", ""), + preview=style.get("preview", None), + filename=fn + ) except Exception as e: log.error(f'Failed to load style: file={fn} error={e}') elif os.path.isdir(fn) and not fn.startswith('.'): diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index b0838a068..1f386d1fc 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -270,7 +270,7 @@ class ExtraNetworksPage: def find_preview(self, path): fn = os.path.splitext(path)[0] preview_extensions = ["jpg", "jpeg", "png", "webp", "tiff", "jp2"] - for file in [f'{fn}{mid}{ext}' for ext in preview_extensions for mid in ['.thumb.', '.preview.', '.']]: + for file in [f'{fn}{mid}{ext}' for ext in preview_extensions for mid in ['.thumb.', '.', '.preview.']]: if os.path.exists(file): if '.thumb.' not in file: self.missing_thumbs.append(file) @@ -286,16 +286,15 @@ class ExtraNetworksPage: if tag == 'p': self.text += '\n' - fn = os.path.splitext(path)[0] - for file in [f"{fn}.txt", f"{fn}.description.txt"]: - if os.path.exists(file): - try: - with open(file, "r", encoding="utf-8", errors="replace") as f: - txt = f.read() - txt = re.sub('[<>]', '', txt) - return txt - except OSError: - pass + fn = os.path.splitext(path)[0] + '.txt' + if os.path.exists(fn): + try: + with open(fn, "r", encoding="utf-8", errors="replace") as f: + txt = f.read() + txt = re.sub('[<>]', '', txt) + return txt + except OSError: + pass info = self.find_info(path) desc = info.get('description', '') or '' f = HTMLFilter() @@ -305,7 +304,10 @@ class ExtraNetworksPage: def find_info(self, path): fn = os.path.splitext(path)[0] + '.json' if os.path.exists(fn): - return shared.readfile(fn, silent=True) + data = shared.readfile(fn, silent=True) + if type(data) is list: + data = data[0] + return data return {} @@ -527,6 +529,7 @@ def create_ui(container, button_parent, tabname, skip_indexing = False): img = page.find_preview_file(item.filename) lora = '' model = '' + style = '' if page.title == 'Model': merge = len(list(meta.get('sd_merge_models', {}))) if merge > 0: @@ -548,6 +551,13 @@ def create_ui(container, button_parent, tabname, skip_indexing = False):
| Hash | {getattr(item, 'hash', 'N/A')} |
| Size | {round(stat.st_size/1024/1024, 2)} MB |
| Last modified | {datetime.fromtimestamp(stat.st_mtime)} |