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

Upload civitai_to_hf.py

Browse files
Files changed (1) hide show
  1. civitai_to_hf.py +3 -1
civitai_to_hf.py CHANGED
@@ -91,7 +91,9 @@ 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
- item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[Model URL](https://civitai.com/models/{j["id"]})'
 
 
95
  items.append(item)
96
  return items
97
 
 
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)
98
  return items
99