Skip to content

Commit

Permalink
Add resources hashes to metadata for auto-detection on Civitai
Browse files Browse the repository at this point in the history
  • Loading branch information
receyuki committed Jan 5, 2024
1 parent 5381de7 commit 3b3da02
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,17 @@ def save_images(
i = 255.0 * image.cpu().numpy()
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
metadata = None
model_hash = (
f"Model hash: {self.calculate_model_hash(model_name_real)}, "
if calculate_model_hash
else ""
)

hashes = {}
if calculate_model_hash:
model_hash = self.calculate_model_hash(model_name_real)
model_hash_str = f"Model hash: {model_hash}, "
hashes["model"] = model_hash
else:
model_hash_str = ""

hashes_str = f"Hashes: {json.dumps(hashes)}, " if hashes else ""

comment = (
f"{positive}\n"
f"Negative prompt: {negative}\n"
Expand All @@ -413,9 +419,10 @@ def save_images(
f"CFG scale: {cfg}, "
f"Seed: {seed}, "
f"Size: {img.width if width==0 else width}x{img.height if height==0 else height}, "
f"{model_hash}"
f"{model_hash_str}"
f"Model: {Path(model_name_real).stem}, "
f"Version: ComfyUI"
f"{hashes_str}"
f"{extra_info_real}"
)

Expand Down

0 comments on commit 3b3da02

Please sign in to comment.