johann-foerster commited on
Commit
45b14e8
·
1 Parent(s): 1291091

debounce input text change

Browse files
Files changed (1) hide show
  1. webui.py +3 -2
webui.py CHANGED
@@ -60,7 +60,7 @@ def finish_generate():
60
  return __toggle_generate_state(False)
61
 
62
  def debounce():
63
- time.sleep(5)
64
  return
65
 
66
  def pil_image_with_overlay(pil_image, toggle_greet, greet):
@@ -149,7 +149,8 @@ with shared.gradio_root:
149
  promt_example_de.change(fn=translate_promt_example, inputs=[promt_example_de], outputs=[prompt], queue=False)
150
  toggle_greet.change(fn=toggle_greet_visibility, inputs=[toggle_greet], outputs=[greeting_row], queue=False, show_progress=False)\
151
  .then(fn=make_overlay, inputs=[generated_image_raw, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], show_progress=False, queue=False)
152
- greet.change(fn=make_overlay, inputs=[generated_image_raw, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], queue=False, show_progress=False)
 
153
  greet_active.change(fn=verify_latest_overlay, inputs=[generated_image_raw, toggle_greet, greet, greet_active], outputs=[generated_image_overlayed, greet_active], queue=False, show_progress=False)
154
  run_button.click(fn=prepare_generate, outputs=[generated_image_raw, generated_image_overlayed, run_button], queue=False)\
155
  .then(fn=generate, inputs=[prompt, style_selection], outputs=[progress_html, generated_image_raw], queue=True)\
 
60
  return __toggle_generate_state(False)
61
 
62
  def debounce():
63
+ time.sleep(0.5)
64
  return
65
 
66
  def pil_image_with_overlay(pil_image, toggle_greet, greet):
 
149
  promt_example_de.change(fn=translate_promt_example, inputs=[promt_example_de], outputs=[prompt], queue=False)
150
  toggle_greet.change(fn=toggle_greet_visibility, inputs=[toggle_greet], outputs=[greeting_row], queue=False, show_progress=False)\
151
  .then(fn=make_overlay, inputs=[generated_image_raw, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], show_progress=False, queue=False)
152
+ greet.change(fn=debounce, queue=False, show_progress=False)\
153
+ .then(fn=make_overlay, inputs=[generated_image_raw, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], queue=False, show_progress=False)
154
  greet_active.change(fn=verify_latest_overlay, inputs=[generated_image_raw, toggle_greet, greet, greet_active], outputs=[generated_image_overlayed, greet_active], queue=False, show_progress=False)
155
  run_button.click(fn=prepare_generate, outputs=[generated_image_raw, generated_image_overlayed, run_button], queue=False)\
156
  .then(fn=generate, inputs=[prompt, style_selection], outputs=[progress_html, generated_image_raw], queue=True)\