Initial commit

This commit is contained in:
Jaret Burkett
2023-07-05 16:44:58 -06:00
commit e4de8983c9
11 changed files with 2185 additions and 0 deletions

24
toolkit/metadata.py Normal file
View File

@@ -0,0 +1,24 @@
import json
software_meta = {
"name": "ai-toolkit",
"url": "https://github.com/ostris/ai-toolkit"
}
def create_meta(dict_list, name=None):
meta = {}
for d in dict_list:
for key, value in d.items():
meta[key] = value
if "name" not in meta:
meta["name"] = "[name]"
meta["software"] = software_meta
# convert to string to handle replacements
meta_string = json.dumps(meta)
if name is not None:
meta_string = meta_string.replace("[name]", name)
return json.loads(meta_string)