ysharma HF staff commited on
Commit
5d6074c
β€’
1 Parent(s): 663b96b

added visualization for image upload

Browse files

The label on UploadButton changes to highlight the image upload is complete.

Files changed (1) hide show
  1. app_dialogue.py +7 -4
app_dialogue.py CHANGED
@@ -96,8 +96,8 @@ def pil_to_temp_file(img: PIL.Image.Image, dir: str = DEFAULT_TEMP_DIR, format:
96
 
97
 
98
  def add_file(file):
99
- return file.name
100
-
101
 
102
  # This is a hack to make pre-computing the default examples work.
103
  # During normal inference, we pass images as url to a local file using the method `gradio_link`
@@ -702,8 +702,11 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
702
  ],
703
  )
704
 
705
- upload_btn.upload(add_file, [upload_btn], [imagebox], queue=False)
706
-
 
 
 
707
  # Using Flagging for saving dope and problematic examples
708
  # Dope examples flagging
709
  # dope_callback.setup(
 
96
 
97
 
98
  def add_file(file):
99
+ return file.name, gr.update(label='πŸ–ΌοΈ Uploaded!')
100
+
101
 
102
  # This is a hack to make pre-computing the default examples work.
103
  # During normal inference, we pass images as url to a local file using the method `gradio_link`
 
702
  ],
703
  )
704
 
705
+ upload_btn.upload(add_file, [upload_btn], [imagebox, upload_btn], queue=False)
706
+ submit_btn.click(lambda : gr.update(label='πŸ“ Upload image', interactive=True), [], upload_btn)
707
+ textbox.submit(lambda : gr.update(label='πŸ“ Upload image', interactive=True), [], upload_btn)
708
+ clear_btn.click(lambda : gr.update(label='πŸ“ Upload image', interactive=True), [], upload_btn)
709
+
710
  # Using Flagging for saving dope and problematic examples
711
  # Dope examples flagging
712
  # dope_callback.setup(