macgaga commited on
Commit
4dbc0e6
·
verified ·
1 Parent(s): 27d5614

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -22
app.py CHANGED
@@ -322,30 +322,23 @@ def download_loras_images(loras_json_orig: list[dict]):
322
  return loras_json
323
 
324
 
325
- def handle_gallery_click(selected_index, loras_state):
326
- """
327
- Handhabt den Klick auf ein Bild in der Galerie.
328
- """
329
- if selected_index is None:
330
- # Kein Bild ausgewählt, zurück zur Galerie-Ansicht
331
- return (
332
- gr.update(visible=True), # Galerie sichtbar
333
- gr.update(visible=False), # Großes Bild unsichtbar
334
- None, # Keine LoRA ausgewählt
335
- None # Keine LoRA-Skalierung
336
- )
337
-
338
- # LoRA-Daten für das ausgewählte Bild
339
  selected_lora = loras_state[selected_index]
340
- large_view_image = selected_lora["image"]
341
- lora_title = selected_lora["title"]
342
 
343
- return (
344
- gr.update(visible=False), # Galerie unsichtbar
345
- gr.update(visible=True, value=large_view_image), # Großes Bild sichtbar
346
- selected_index, # Ausgewählter Index
347
- lora_title # Titel des LoRA
348
- )
 
 
 
 
 
 
349
 
350
 
351
  def toggle_large_view(selected_index, loras_state):
 
322
  return loras_json
323
 
324
 
325
+ def handle_gallery_click(evt: gr.SelectData, loras_state):
326
+ """Behandelt Klicks auf Galerie-Elemente."""
327
+ selected_index = evt.index
 
 
 
 
 
 
 
 
 
 
 
328
  selected_lora = loras_state[selected_index]
 
 
329
 
330
+ # Großansicht vorbereiten
331
+ large_image = selected_lora["image"]
332
+ title = selected_lora["title"]
333
+
334
+ # Galerie ausblenden, Großansicht und Select-Button einblenden
335
+ return gr.update(visible=False), gr.update(value=large_image, visible=True), gr.update(visible=True)
336
+
337
+ def toggle_large_view(selected_indices, loras_state):
338
+ """Kehrt von der Großansicht zur Galerie-Ansicht zurück."""
339
+ # Großansicht ausblenden, Galerie einblenden
340
+ return gr.update(visible=True), gr.update(visible=False)
341
+
342
 
343
 
344
  def toggle_large_view(selected_index, loras_state):