Gradio 4: handle changed gallery return format

ib4
AlUlkesh 2023-12-11 08:38:03 +01:00
parent 323ce7efef
commit 7301877532
1 changed files with 5 additions and 1 deletions

View File

@ -1017,7 +1017,11 @@ def show_image_info(tab_base_tag_box, num, page_index, filenames, turn_page_swit
video_checkbox_panel = False
video_checkbox = False
image_gallery = [image["name"] for image in image_gallery]
gradio_new = "4.0.0"
if version.parse(gr.__version__) < version.parse(gradio_new):
image_gallery = [image["name"] for image in image_gallery]
else:
image_gallery = [image_gallery_element.image.path for image_gallery_element in image_gallery.root]
if len(filenames) == 0:
# This should only happen if webui was stopped and started again and the user clicks on one of the still displayed images.