dropbop commited on
Commit
4561290
·
verified ·
1 Parent(s): d56788b

Fix display_ui function

Browse files

# Key Changes:

## Removed .update(): The line new_image_component.update(value=image) has been removed.

## Initialize Component Values:

Created a new function initialize_display_ui() to set the initial values of the components. This function returns the initial image, and gallery arrays.

We call initialize_display_ui() and set the values of the components directly using new_image_component.value = initial_image and cool_images_gallery.value = initial_gallery.

With this correction, your display_ui() function should work as intended. The error AttributeError: 'Image' object has no attribute 'update' should be resolved.

Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -151,9 +151,13 @@ def display_ui():
151
  refresh_button.click(fn=refresh_display, inputs=[], outputs=[gr.Textbox(label="Debug"), new_image_component, cool_images_gallery])
152
 
153
  # Initialize
154
- debug, image, gallery = refresh_display()
155
- new_image_component.update(value=image)
156
- cool_images_gallery.update(value=gallery)
 
 
 
 
157
 
158
  # --- Main Interface ---
159
  with gr.Blocks() as demo:
 
151
  refresh_button.click(fn=refresh_display, inputs=[], outputs=[gr.Textbox(label="Debug"), new_image_component, cool_images_gallery])
152
 
153
  # Initialize
154
+ def initialize_display_ui():
155
+ debug, image, gallery = refresh_display()
156
+ return debug, image, gallery
157
+
158
+ debug, initial_image, initial_gallery = initialize_display_ui()
159
+ new_image_component.value = initial_image
160
+ cool_images_gallery.value = initial_gallery
161
 
162
  # --- Main Interface ---
163
  with gr.Blocks() as demo: