mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
* Feature complete for #266 with exception of several small deviations: 1. initial image and model weight hashes use full sha256 hash rather than first 8 digits 2. Initialization parameters for post-processing steps not provided 3. Uses top-level "images" tags for both a single image and a grid of images. This change was suggested in a comment. * Added scripts/sd_metadata.py to retrieve and print metadata from PNG files * New ldm.dream.args.Args class is a namespace like object which holds all defaults and can be modified during exection to hold current settings. * Modified dream.py and server.py to accommodate Args class.
This commit is contained in:
22
scripts/sd-metadata.py
Normal file
22
scripts/sd-metadata.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import json
|
||||
from ldm.dream.pngwriter import retrieve_metadata
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: file2prompt.py <file1.png> <file2.png> <file3.png>...")
|
||||
print("This script opens up the indicated dream.py-generated PNG file(s) and prints out their metadata.")
|
||||
exit(-1)
|
||||
|
||||
filenames = sys.argv[1:]
|
||||
for f in filenames:
|
||||
try:
|
||||
metadata = retrieve_metadata(f)
|
||||
print(f'{f}:\n',json.dumps(metadata, indent=4))
|
||||
except FileNotFoundError:
|
||||
sys.stderr.write(f'{f} not found\n')
|
||||
continue
|
||||
except PermissionError:
|
||||
sys.stderr.write(f'{f} could not be opened due to inadequate permissions\n')
|
||||
continue
|
Reference in New Issue
Block a user