Lisandro commited on
Commit
8135193
·
1 Parent(s): a289439

Refactor app.py to remove unused example components and delete cat.webp

Browse files
Files changed (2) hide show
  1. app.py +7 -8
  2. cat.webp +0 -0
app.py CHANGED
@@ -202,8 +202,7 @@ def update_selection(evt: gr.SelectData, aspect_ratio):
202
  gr.update(placeholder=new_placeholder),
203
  updated_text,
204
  evt.index,
205
- aspect_ratio,
206
- gr.Examples(examples=examples_list, inputs=[prompt], label="Sample Prompts")
207
  )
208
 
209
  def handle_speed_mode(speed_mode):
@@ -465,17 +464,17 @@ def add_custom_lora(custom_lora):
465
  loras.append(new_item)
466
  existing_item_index = len(loras) - 1 # Get the actual index after adding
467
 
468
- return gr.update(visible=True, value=card), gr.update(visible=True), gr.Gallery(selected_index=None), f"Custom: {path}", existing_item_index, trigger_word, gr.Examples(examples=[], inputs=[prompt], label="Sample Prompts")
469
  except Exception as e:
470
  full_traceback = traceback.format_exc()
471
  print(f"Full traceback:\n{full_traceback}")
472
  gr.Warning(f"Invalid LoRA: either you entered an invalid link, or a non-Qwen-Image LoRA, this was the issue: {e}")
473
  return gr.update(visible=True, value=f"Invalid LoRA: either you entered an invalid link, a non-Qwen-Image LoRA"), gr.update(visible=True), gr.update(), "", None, ""
474
  else:
475
- return gr.update(visible=False), gr.update(visible=False), gr.update(), "", None, "", gr.Examples(examples=[], inputs=[prompt], label="Sample Prompts", visible=False)
476
 
477
  def remove_custom_lora():
478
- return gr.update(visible=False), gr.update(visible=False), gr.update(), "", None, "", gr.Examples(examples=[], inputs=[prompt], label="Sample Prompts", visible=False), gr.Examples(examples=[], inputs=[prompt], label="Sample Prompts", visible=False)
479
 
480
  run_lora.zerogpu = True
481
 
@@ -576,7 +575,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css, delete_cache=(60, 60)) as app:
576
  gallery.select(
577
  update_selection,
578
  inputs=[aspect_ratio],
579
- outputs=[prompt, selected_info, selected_index, aspect_ratio, examples_component]
580
  )
581
 
582
  speed_mode.change(
@@ -588,12 +587,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css, delete_cache=(60, 60)) as app:
588
  custom_lora.input(
589
  add_custom_lora,
590
  inputs=[custom_lora],
591
- outputs=[custom_lora_info, custom_lora_button, gallery, selected_info, selected_index, prompt, examples_component]
592
  )
593
 
594
  custom_lora_button.click(
595
  remove_custom_lora,
596
- outputs=[custom_lora_info, custom_lora_button, gallery, selected_info, selected_index, custom_lora, examples_component]
597
  )
598
 
599
  gr.on(
 
202
  gr.update(placeholder=new_placeholder),
203
  updated_text,
204
  evt.index,
205
+ aspect_ratio
 
206
  )
207
 
208
  def handle_speed_mode(speed_mode):
 
464
  loras.append(new_item)
465
  existing_item_index = len(loras) - 1 # Get the actual index after adding
466
 
467
+ return gr.update(visible=True, value=card), gr.update(visible=True), gr.Gallery(selected_index=None), f"Custom: {path}", existing_item_index, trigger_word
468
  except Exception as e:
469
  full_traceback = traceback.format_exc()
470
  print(f"Full traceback:\n{full_traceback}")
471
  gr.Warning(f"Invalid LoRA: either you entered an invalid link, or a non-Qwen-Image LoRA, this was the issue: {e}")
472
  return gr.update(visible=True, value=f"Invalid LoRA: either you entered an invalid link, a non-Qwen-Image LoRA"), gr.update(visible=True), gr.update(), "", None, ""
473
  else:
474
+ return gr.update(visible=False), gr.update(visible=False), gr.update(), "", None, ""
475
 
476
  def remove_custom_lora():
477
+ return gr.update(visible=False), gr.update(visible=False), gr.update(), "", None, ""
478
 
479
  run_lora.zerogpu = True
480
 
 
575
  gallery.select(
576
  update_selection,
577
  inputs=[aspect_ratio],
578
+ outputs=[prompt, selected_info, selected_index, aspect_ratio]
579
  )
580
 
581
  speed_mode.change(
 
587
  custom_lora.input(
588
  add_custom_lora,
589
  inputs=[custom_lora],
590
+ outputs=[custom_lora_info, custom_lora_button, gallery, selected_info, selected_index, prompt]
591
  )
592
 
593
  custom_lora_button.click(
594
  remove_custom_lora,
595
+ outputs=[custom_lora_info, custom_lora_button, gallery, selected_info, selected_index, custom_lora]
596
  )
597
 
598
  gr.on(
cat.webp DELETED
Binary file (35.8 kB)