Spaces:
Runtime error
Runtime error
added visualization for image upload
Browse filesThe label on UploadButton changes to highlight the image upload is complete.
- 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(
|