sd-webui-deforum/helpers/settings.py

23 lines
1.0 KiB
Python

import os
import json
def load_args(args_dict,anim_args_dict, custom_settings_file):
print(f"reading custom settings from {custom_settings_file}")
if not os.path.isfile(custom_settings_file):
print('The custom settings file does not exist. The in-notebook settings will be used instead')
else:
with open(custom_settings_file, "r") as f:
jdata = json.loads(f.read())
animation_prompts = jdata["prompts"]
for i, k in enumerate(args_dict):
if k in jdata:
args_dict[k] = jdata[k]
else:
print(f"key {k} doesn't exist in the custom settings data! using the default value of {args_dict[k]}")
for i, k in enumerate(anim_args_dict):
if k in jdata:
anim_args_dict[k] = jdata[k]
else:
print(f"key {k} doesn't exist in the custom settings data! using the default value of {anim_args_dict[k]}")
print(args_dict)
print(anim_args_dict)