From 65618f3e077d4014a6f0569be2bbb76fc09cbfec Mon Sep 17 00:00:00 2001 From: AlUlkesh <99896447+AlUlkesh@users.noreply.github.com> Date: Mon, 21 Aug 2023 00:20:02 +0200 Subject: [PATCH] fix for Gradio 3.39 compatibility --- javascript/image_browser.js | 6 ++++-- scripts/image_browser.py | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/javascript/image_browser.js b/javascript/image_browser.js index 4abd3ad..6bcea10 100644 --- a/javascript/image_browser.js +++ b/javascript/image_browser.js @@ -95,8 +95,10 @@ const image_browser_click_image = async function() { const container = gradioApp().getElementById(tab_base_tag + "_image_browser_container") let child = this let index = 0 - while((child = child.previousSibling) != null) { - index = index + 1 + while ((child = child.previousSibling) != null) { + if (child.nodeType === Node.ELEMENT_NODE) { + index = index + 1 + } } const set_btn = container.querySelector(".image_browser_set_index") let curr_idx diff --git a/scripts/image_browser.py b/scripts/image_browser.py index efe6801..4ecda58 100644 --- a/scripts/image_browser.py +++ b/scripts/image_browser.py @@ -997,9 +997,10 @@ def show_image_info(tab_base_tag_box, num, page_index, filenames, turn_page_swit if opts.image_browser_use_thumbnail: image_gallery = [image['name'] for image in image_gallery] image_gallery[int(num)] = filenames[file_num] - return file, tm, num, file, turn_page_switch, info, image_gallery - else: - return file, tm, num, file, turn_page_switch, info + if opts.image_browser_use_thumbnail: + return file, tm, num, file, turn_page_switch, info, image_gallery + else: + return file, tm, num, file, turn_page_switch, info def change_dir(img_dir, path_recorder, load_switch, img_path_browser, img_path_depth, img_path): warning = None