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
1e8e5245eb
commit
c3712b013f
@ -602,6 +602,16 @@ def metadata_dumps(opt,
|
||||
This is intended to be turned into JSON and stored in the
|
||||
"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
|
||||
# user args
|
||||
image_dict = opt.to_dict(
|
||||
@ -647,22 +657,22 @@ def metadata_dumps(opt,
|
||||
else:
|
||||
rfc_dict['type'] = 'txt2img'
|
||||
|
||||
images = []
|
||||
if len(seeds)==0 and opt.seed:
|
||||
seeds=[seed]
|
||||
|
||||
for seed in seeds:
|
||||
rfc_dict['seed'] = seed
|
||||
images.append(copy.copy(rfc_dict))
|
||||
|
||||
return {
|
||||
'model' : 'stable diffusion',
|
||||
'model_id' : opt.model,
|
||||
'model_hash' : model_hash,
|
||||
'app_id' : APP_ID,
|
||||
'app_version' : APP_VERSION,
|
||||
'images' : images,
|
||||
}
|
||||
if opt.grid:
|
||||
images = []
|
||||
for seed in seeds:
|
||||
rfc_dict['seed'] = seed
|
||||
images.append(copy.copy(rfc_dict))
|
||||
metadata['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):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user