File size: 718 Bytes
da50adf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)