mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-01-26 16:39:47 +00:00
Initial commit
This commit is contained in:
24
toolkit/metadata.py
Normal file
24
toolkit/metadata.py
Normal 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)
|
||||
Reference in New Issue
Block a user