aboutsummaryrefslogtreecommitdiff
path: root/modules/extra_networks.py
diff options
context:
space:
mode:
authorKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2023-08-05 10:43:17 +0800
committerKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2023-08-05 10:43:17 +0800
commit9ac2989edd78d797c77c131c058cae38d139868e (patch)
tree8256efa7b9fd9e38509cbfe8ffd5ad9a9d23629c /modules/extra_networks.py
parent21000f13a169263a7da2c66b300130d7a6339c7d (diff)
parent45601766409e531d2b4ee512bf1433600f140183 (diff)
Merge branch 'dev' into efficient-vae-methods
Diffstat (limited to 'modules/extra_networks.py')
-rw-r--r--modules/extra_networks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/extra_networks.py b/modules/extra_networks.py
index 6ae07e91..fa28ac75 100644
--- a/modules/extra_networks.py
+++ b/modules/extra_networks.py
@@ -1,3 +1,5 @@
+import json
+import os
import re
from collections import defaultdict
@@ -177,3 +179,20 @@ def parse_prompts(prompts):
return res, extra_data
+
+def get_user_metadata(filename):
+ if filename is None:
+ return {}
+
+ basename, ext = os.path.splitext(filename)
+ metadata_filename = basename + '.json'
+
+ metadata = {}
+ try:
+ if os.path.isfile(metadata_filename):
+ with open(metadata_filename, "r", encoding="utf8") as file:
+ metadata = json.load(file)
+ except Exception as e:
+ errors.display(e, f"reading extra network user metadata from {metadata_filename}")
+
+ return metadata