Update civitaiinfo_convert.py
Browse files- civitaiinfo_convert.py +10 -2
civitaiinfo_convert.py
CHANGED
|
@@ -18,13 +18,21 @@ for file in glob.glob("**/*.civitai.info", recursive=True):
|
|
| 18 |
print(jsonname)
|
| 19 |
with open(file) as f:
|
| 20 |
info = json.load(f)
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# out["description"] = info.get("description", "")
|
| 23 |
# if not out["description"]:
|
| 24 |
out["description"] = description
|
| 25 |
out["activation text"] = ", ".join(info["trainedWords"])
|
| 26 |
out["notes"] = f"https://civitai.com/models/{info['modelId']}?modelVersionId={info['id']}"
|
| 27 |
-
|
|
|
|
| 28 |
print(jsonname)
|
| 29 |
with open(jsonname, "w") as f:
|
| 30 |
json.dump(out, f, indent=4)
|
|
|
|
| 18 |
print(jsonname)
|
| 19 |
with open(file) as f:
|
| 20 |
info = json.load(f)
|
| 21 |
+
|
| 22 |
+
sdversion = "Unknown"
|
| 23 |
+
if 'SD 1' in info['baseModel']:
|
| 24 |
+
sdversion = "SD1"
|
| 25 |
+
if 'SD 2' in info['baseModel']:
|
| 26 |
+
sdversion = "SD2"
|
| 27 |
+
if 'SDXL' in info['baseModel']:
|
| 28 |
+
sdversion = "SDXL"
|
| 29 |
# out["description"] = info.get("description", "")
|
| 30 |
# if not out["description"]:
|
| 31 |
out["description"] = description
|
| 32 |
out["activation text"] = ", ".join(info["trainedWords"])
|
| 33 |
out["notes"] = f"https://civitai.com/models/{info['modelId']}?modelVersionId={info['id']}"
|
| 34 |
+
out["sd version"] = sdversion
|
| 35 |
+
out["preferred weight"] = 1
|
| 36 |
print(jsonname)
|
| 37 |
with open(jsonname, "w") as f:
|
| 38 |
json.dump(out, f, indent=4)
|