mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes metadata implementation #686
This commit is contained in:
parent
73154a25d4
commit
61611d7d0d
@ -602,6 +602,16 @@ def metadata_dumps(opt,
|
|||||||
This is intended to be turned into JSON and stored in the
|
This is intended to be turned into JSON and stored in the
|
||||||
"sd
|
"sd
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# top-level metadata minus `image` or `images`
|
||||||
|
metadata = {
|
||||||
|
'model' : 'stable diffusion',
|
||||||
|
'model_id' : opt.model,
|
||||||
|
'model_hash' : model_hash,
|
||||||
|
'app_id' : APP_ID,
|
||||||
|
'app_version' : APP_VERSION,
|
||||||
|
}
|
||||||
|
|
||||||
# add some RFC266 fields that are generated internally, and not as
|
# add some RFC266 fields that are generated internally, and not as
|
||||||
# user args
|
# user args
|
||||||
image_dict = opt.to_dict(
|
image_dict = opt.to_dict(
|
||||||
@ -647,22 +657,22 @@ def metadata_dumps(opt,
|
|||||||
else:
|
else:
|
||||||
rfc_dict['type'] = 'txt2img'
|
rfc_dict['type'] = 'txt2img'
|
||||||
|
|
||||||
images = []
|
|
||||||
if len(seeds)==0 and opt.seed:
|
if len(seeds)==0 and opt.seed:
|
||||||
seeds=[seed]
|
seeds=[seed]
|
||||||
|
|
||||||
for seed in seeds:
|
|
||||||
rfc_dict['seed'] = seed
|
|
||||||
images.append(copy.copy(rfc_dict))
|
|
||||||
|
|
||||||
return {
|
if opt.grid:
|
||||||
'model' : 'stable diffusion',
|
images = []
|
||||||
'model_id' : opt.model,
|
for seed in seeds:
|
||||||
'model_hash' : model_hash,
|
rfc_dict['seed'] = seed
|
||||||
'app_id' : APP_ID,
|
images.append(copy.copy(rfc_dict))
|
||||||
'app_version' : APP_VERSION,
|
metadata['images'] = images
|
||||||
'images' : images,
|
else:
|
||||||
}
|
# there should only ever be a single seed if we did not generate a grid
|
||||||
|
assert len(seeds) == 1, 'Expected a single seed'
|
||||||
|
rfc_dict['seed'] = seeds[0]
|
||||||
|
metadata['image'] = rfc_dict
|
||||||
|
|
||||||
|
return metadata
|
||||||
|
|
||||||
def metadata_loads(metadata):
|
def metadata_loads(metadata):
|
||||||
'''
|
'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user