TomyAI commited on
Commit
3256f40
1 Parent(s): 94aacdd

Update civitaiinfo_convert.py

Browse files
Files changed (1) hide show
  1. civitaiinfo_convert.py +7 -5
civitaiinfo_convert.py CHANGED
@@ -15,10 +15,13 @@ for file in glob.glob("**/*.civitai.info", recursive=True):
15
  description = f.read()
16
  f.close()
17
 
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"
@@ -33,6 +36,5 @@ for file in glob.glob("**/*.civitai.info", recursive=True):
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)
 
15
  description = f.read()
16
  f.close()
17
 
18
+ try:
19
+ with open(file) as f:
20
+ info = json.load(f)
21
+ except:
22
+ print("ERROR: json load error :", jsonname)
23
+ continue
24
+ print("Processing :",jsonname)
25
  sdversion = "Unknown"
26
  if 'SD 1' in info['baseModel']:
27
  sdversion = "SD1"
 
36
  out["notes"] = f"https://civitai.com/models/{info['modelId']}?modelVersionId={info['id']}"
37
  out["sd version"] = sdversion
38
  out["preferred weight"] = 1
 
39
  with open(jsonname, "w") as f:
40
  json.dump(out, f, indent=4)