John6666 commited on
Commit
ffe9ea4
1 Parent(s): 7ef2b21

Upload civitai_to_hf.py

Browse files
Files changed (1) hide show
  1. civitai_to_hf.py +1 -1
civitai_to_hf.py CHANGED
@@ -91,7 +91,7 @@ def search_on_civitai(query: str, types: list[str], allow_model: list[str] = [],
91
  item['model_name'] = model['name'] if 'name' in model.keys() else ""
92
  item['base_model'] = model['baseModel'] if 'baseModel' in model.keys() else ""
93
  item['dl_url'] = model['downloadUrl']
94
- if 'images' in model.keys():
95
  item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[Model URL](https://civitai.com/models/{j["id"]})'
96
  else: item['md'] = f'[Model URL](https://civitai.com/models/{j["id"]})'
97
  items.append(item)
 
91
  item['model_name'] = model['name'] if 'name' in model.keys() else ""
92
  item['base_model'] = model['baseModel'] if 'baseModel' in model.keys() else ""
93
  item['dl_url'] = model['downloadUrl']
94
+ if 'images' in model.keys() and len(model["images"]) != 0:
95
  item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[Model URL](https://civitai.com/models/{j["id"]})'
96
  else: item['md'] = f'[Model URL](https://civitai.com/models/{j["id"]})'
97
  items.append(item)