aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNandaka <nchek2000@gmail.com>2022-11-24 02:39:09 +0000
committerNandaka <nchek2000@gmail.com>2022-11-24 02:39:09 +0000
commit904121fecc0a1f11db76a73ca8649fb21e05ac5b (patch)
tree027ba875dc107a6e0227a6b160dce58407b8243f
parent828438b4a190759807f9054932cae3a8b880ddf1 (diff)
Support NAI exif for PNG Info
-rw-r--r--modules/extras.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/extras.py b/modules/extras.py
index 71b93a06..af4cd97d 100644
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -233,6 +233,20 @@ def run_pnginfo(image):
geninfo = items.get('parameters', geninfo)
+ # nai prompt
+ if "Software" in items.keys() and items["Software"] == "NovelAI":
+ import json
+ json_info = json.loads(items["Comment"])
+ geninfo = f'{items["Description"]}\r\nNegative prompt: {json_info["uc"]}\r\n'
+ sampler = "Euler a"
+ if json_info["sampler"] == "k_euler_ancestral":
+ sampler = "Euler a"
+ elif json_info["sampler"] == "k_euler":
+ sampler = "Euler"
+ model_hash = '925997e9' # assuming this is the correct model hash
+ # not sure with noise and strength parameter
+ geninfo += f'Steps: {json_info["steps"]}, Sampler: {sampler}, CFG scale: {json_info["scale"]}, Seed: {json_info["seed"]}, Size: {image.width}x{image.height}, Model hash: {model_hash}' # , Denoising strength: {json_info["noise"]}'
+
info = ''
for key, text in items.items():
info += f"""