aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_extra_networks_hypernets.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-13 13:46:32 +0000
committerGitHub <noreply@github.com>2023-08-13 13:46:32 +0000
commit1c6ca09992fc2c4f7a250670246762a184abace3 (patch)
tree4d61ec966a5924fd92b435c4750ee93720ed3539 /modules/ui_extra_networks_hypernets.py
parentd73db17ee330ceb256defeab00a6097b943f923b (diff)
parent7fa5ee54b15904bef6598800df76ba1291d44ec6 (diff)
downloadstable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.tar.gz
stable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.tar.bz2
stable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.zip
Merge pull request #12510 from catboxanon/feat/extnet/hashes
Support search and display of hashes for all extra network items
Diffstat (limited to 'modules/ui_extra_networks_hypernets.py')
-rw-r--r--modules/ui_extra_networks_hypernets.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/ui_extra_networks_hypernets.py b/modules/ui_extra_networks_hypernets.py
index 514a4562..4cedf085 100644
--- a/modules/ui_extra_networks_hypernets.py
+++ b/modules/ui_extra_networks_hypernets.py
@@ -2,6 +2,7 @@ import os
from modules import shared, ui_extra_networks
from modules.ui_extra_networks import quote_js
+from modules.hashes import sha256_from_cache
class ExtraNetworksPageHypernetworks(ui_extra_networks.ExtraNetworksPage):
@@ -14,13 +15,16 @@ class ExtraNetworksPageHypernetworks(ui_extra_networks.ExtraNetworksPage):
def create_item(self, name, index=None, enable_filter=True):
full_path = shared.hypernetworks[name]
path, ext = os.path.splitext(full_path)
+ sha256 = sha256_from_cache(full_path, f'hypernet/{name}')
+ shorthash = sha256[0:10] if sha256 else None
return {
"name": name,
"filename": full_path,
+ "shorthash": shorthash,
"preview": self.find_preview(path),
"description": self.find_description(path),
- "search_term": self.search_terms_from_path(path),
+ "search_term": self.search_terms_from_path(path) + " " + (sha256 or ""),
"prompt": quote_js(f"<hypernet:{name}:") + " + opts.extra_networks_default_multiplier + " + quote_js(">"),
"local_preview": f"{path}.preview.{shared.opts.samples_format}",
"sort_keys": {'default': index, **self.get_sort_keys(path + ext)},