diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui
index 9903b0395..03e365e0b 160000
--- a/extensions-builtin/sdnext-modernui
+++ b/extensions-builtin/sdnext-modernui
@@ -1 +1 @@
-Subproject commit 9903b0395f5119dcbca6379a4e34887c9154d782
+Subproject commit 03e365e0b0ec5e1cc442c9dbe683b61321fc5630
diff --git a/modules/models_civitai.py b/modules/models_civitai.py
index 6f86eba77..8bc2d47b9 100644
--- a/modules/models_civitai.py
+++ b/modules/models_civitai.py
@@ -31,16 +31,8 @@ def civit_update_metadata():
def create_update_metadata_table(rows: list[CivitModel]):
html = """
-
-
- | ID |
- File |
- Name |
- Hash |
- Versions |
- Latest |
- Status |
-
+
+ | File | ID | Name | Hash | Versions | Latest | Status |
{tbody}
@@ -52,8 +44,8 @@ def civit_update_metadata():
try:
tbody += f"""
- | {row.id} |
{row.file} |
+ {row.id} |
{row.name} |
{row.sha} |
{row.versions} |
@@ -103,11 +95,11 @@ def civit_update_metadata():
model.url = f.get('downloadUrl', None)
model.latest_name = f.get('name', '')
if model.vername == model.latest:
- model.status = 'Latest'
+ model.status = 'Latest version'
elif any(map(lambda v: v in model.latest_hashes, all_hashes)): # pylint: disable=cell-var-from-loop # noqa: C417
- model.status = 'Downloaded'
+ model.status = 'Update downloaded'
else:
- model.status = 'Available'
+ model.status = 'Update available'
break
results.append(model)
yield create_update_metadata_table(results)
@@ -226,7 +218,11 @@ def atomic_civit_search_metadata(item, results):
from modules.modelloader import download_civit_preview, download_civit_meta
if item is None:
return
- meta = os.path.splitext(item['filename'])[0] + '.json'
+ try:
+ meta = os.path.splitext(item['filename'])[0] + '.json'
+ except Exception:
+ # log.error(f'CivitAI search metadata: item={item} {e}')
+ return
has_meta = os.path.isfile(meta) and os.stat(meta).st_size > 0
if ('card-no-preview.png' in item['preview'] or not has_meta) and os.path.isfile(item['filename']):
sha = item.get('hash', None)
@@ -288,8 +284,8 @@ def civit_search_metadata(title: str = None):
def create_search_metadata_table(rows):
html = """
-
- | ID | Name | Type | Code | Hash | Size | Note |
+
+ | Name | ID | Type | Code | Hash | Size | Note |
{tbody}
@@ -301,8 +297,8 @@ def civit_search_metadata(title: str = None):
try:
tbody += f"""
- | {row['id']} |
{row['name']} |
+ {row['id']} |
{row['type']} |
{row['code']} |
{row['hash']} |
diff --git a/modules/sd_checkpoint.py b/modules/sd_checkpoint.py
index b54eb701f..1f193f603 100644
--- a/modules/sd_checkpoint.py
+++ b/modules/sd_checkpoint.py
@@ -153,20 +153,43 @@ def list_models():
def update_model_hashes():
- txt = []
+ def update_model_hashes_table(rows):
+ html = """
+
+
+ | Name | Type | Hash |
+
+
+ {tbody}
+
+
+ """
+ tbody = ''
+ for row in rows:
+ try:
+ tbody += f"""
+
+ | {row.name} |
+ {row.type} |
+ {row.shorthash} |
+
+ """
+ except Exception as e:
+ shared.log.error(f'Model list: row={row} {e}')
+ return html.format(tbody=tbody)
+
lst = [ckpt for ckpt in checkpoints_list.values() if ckpt.hash is None]
for ckpt in lst:
ckpt.hash = model_hash(ckpt.filename)
lst = [ckpt for ckpt in checkpoints_list.values() if ckpt.sha256 is None or ckpt.shorthash is None]
shared.log.info(f'Models list: hash missing={len(lst)} total={len(checkpoints_list)}')
+ updated = []
for ckpt in lst:
ckpt.sha256 = hashes.sha256(ckpt.filename, f"checkpoint/{ckpt.name}")
ckpt.shorthash = ckpt.sha256[0:10] if ckpt.sha256 is not None else None
- if ckpt.sha256 is not None:
- txt.append(f'Hash: {ckpt.title} {ckpt.shorthash}')
- txt.append(f'Updated hashes for {len(lst)} out of {len(checkpoints_list)} models')
- txt = '
'.join(txt)
- return txt
+ updated.append(ckpt)
+ yield update_model_hashes_table(updated)
+ return
def remove_hash(s):
diff --git a/modules/ui_models.py b/modules/ui_models.py
index f5290ba08..56f505052 100644
--- a/modules/ui_models.py
+++ b/modules/ui_models.py
@@ -27,7 +27,7 @@ def create_ui():
def create_modules_table(rows: list):
html = """
-
+
| Module | Class | Device | Dtype | Quant | Params | Modules | Config |
@@ -83,7 +83,7 @@ def create_ui():
from modules import sd_detect
html = """
-
+
| Name | Type | Detect | Pipeline | Hash | Size | MTime |
@@ -131,10 +131,10 @@ def create_ui():
with gr.Row():
model_list_btn = gr.Button(value="List models", variant='primary')
model_checkhash_btn = gr.Button(value="Calculate missing hashes", variant='secondary')
- model_checkhash_btn.click(fn=sd_models.update_model_hashes, inputs=[], outputs=[models_outcome])
with gr.Row():
model_table = gr.HTML(value='', elem_id="model_list_table")
+ model_checkhash_btn.click(fn=sd_models.update_model_hashes, inputs=[], outputs=[model_table])
model_list_btn.click(fn=lambda: create_models_table(sd_models.checkpoints_list.values()), inputs=[], outputs=[model_table])
with gr.Tab(label="Metadata"):