tonyassi commited on
Commit
c0c66f4
1 Parent(s): 44e13e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -38,6 +38,9 @@ def restore_version(index, versions):
38
  final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
39
  return final_dict
40
 
 
 
 
41
  @spaces.GPU()
42
  def generate(image_editor, prompt, neg_prompt, versions):
43
  image = image_editor['background'].convert('RGB')
@@ -119,5 +122,6 @@ with gr.Blocks() as demo:
119
  version_gallery.select(get_select_index, None, selected)
120
  generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
121
  restore_button.click(fn=restore_version, inputs=[selected, version_gallery], outputs=sketch_pad)
 
122
 
123
  demo.launch()
 
38
  final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
39
  return final_dict
40
 
41
+ def clear_all():
42
+ return gr.update(value=None), gr.update(value=None), gr.update(value=[]), gr.update(visible=False), gr.update(visible=False)
43
+
44
  @spaces.GPU()
45
  def generate(image_editor, prompt, neg_prompt, versions):
46
  image = image_editor['background'].convert('RGB')
 
122
  version_gallery.select(get_select_index, None, selected)
123
  generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
124
  restore_button.click(fn=restore_version, inputs=[selected, version_gallery], outputs=sketch_pad)
125
+ clear_button.click(clear_all, inputs=None, outputs=[sketch_pad, prompt, version_gallery, restore_button, clear_button])
126
 
127
  demo.launch()