diff --git a/modules/shared.py b/modules/shared.py index 092ae8214..b467638ec 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -444,7 +444,7 @@ options_templates.update(options_section(('live-preview', "Live Previews"), { "live_preview_content": OptionInfo("Combined", "Live preview subject", gr.Radio, {"choices": ["Combined", "Prompt", "Negative prompt"]}), "live_preview_refresh_period": OptionInfo(250, "Progressbar/preview update period, in milliseconds", gr.Slider, {"minimum": 0, "maximum": 5000, "step": 25}), "logmonitor_show": OptionInfo(True, "Show log view"), - "logmonitor_refresh_period": OptionInfo(1000, "Log view update period, in milliseconds", gr.Slider, {"minimum": 0, "maximum": 5000, "step": 25}), + "logmonitor_refresh_period": OptionInfo(5000, "Log view update period, in milliseconds", gr.Slider, {"minimum": 0, "maximum": 30000, "step": 25}), })) options_templates.update(options_section(('sampler-params', "Sampler Settings"), { diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 6d86ff30c..164b8f4d3 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -2,9 +2,11 @@ import json import html import os.path import urllib.parse +import threading from pathlib import Path from collections import OrderedDict import gradio as gr +from PIL import Image from modules import shared, scripts from modules.generation_parameters_copypaste import image_from_url_text from modules.ui_components import ToolButton @@ -56,6 +58,7 @@ class ExtraNetworksPage: self.allow_negative_prompt = False self.metadata = {} self.items = [] + self.missing_thumbs = [] def refresh(self): pass @@ -93,6 +96,24 @@ class ExtraNetworksPage: files = [f for f in os.listdir(folder) if f.lower().endswith(".ckpt") or f.lower().endswith(".safetensors") or f.lower().endswith(".pt")] return len(files) == 0 + def create_thumb(self): + created = 0 + for f in self.missing_thumbs: + fn, _ext = os.path.splitext(f) + fn = fn.replace('.preview', '') + fn = f'{fn}.thumb.jpg' + if os.path.exists(fn): + continue + created += 1 + img = Image.open(f) + img = img.convert('RGB') + img.thumbnail((512, 512), Image.HAMMING) + img.save(fn) + img.close() + if len(self.missing_thumbs) > 0: + shared.log.info(f"Extra network created thumbnails: {self.name} {created}") + self.missing_thumbs.clear() + def create_html(self, tabname): view = shared.opts.extra_networks_default_view items_html = '' @@ -130,13 +151,10 @@ class ExtraNetworksPage: items_html = shared.html("extra-networks-no-cards.html").format(dirs=dirs) self_name_id = self.name.replace(" ", "_") res = f""" -