Spaces:
Running
on
Zero
Running
on
Zero
import json | |
def update_gallery_with_civitai_loras(civitai_results, loras_state): | |
"""Aktualisiert die Galerie mit Civitai-LoRAs.""" | |
new_loras = [] | |
for lora in civitai_results: | |
new_loras.append({ | |
"title": lora["name"], | |
"repo": lora["repo"], | |
"image": lora["image"], # URL des Vorschaubildes | |
"trigger_word": lora.get("trigger_word", "") # Optional | |
}) | |
loras_state.extend(new_loras) | |
return loras_state, [(item["image"], item["title"]) for item in loras_state] | |
def save_loras_to_json(loras_state, json_file='loras.json'): | |
"""Speichert LoRAs in der JSON-Datei.""" | |
with open(json_file, 'w') as f: | |
json.dump(loras_state, f) | |