fix for Gradio 3.39 compatibility

pull/237/head
AlUlkesh 2023-08-21 00:20:02 +02:00
parent 6fe65accb3
commit 65618f3e07
2 changed files with 8 additions and 5 deletions

View File

@ -95,8 +95,10 @@ const image_browser_click_image = async function() {
const container = gradioApp().getElementById(tab_base_tag + "_image_browser_container") const container = gradioApp().getElementById(tab_base_tag + "_image_browser_container")
let child = this let child = this
let index = 0 let index = 0
while((child = child.previousSibling) != null) { while ((child = child.previousSibling) != null) {
index = index + 1 if (child.nodeType === Node.ELEMENT_NODE) {
index = index + 1
}
} }
const set_btn = container.querySelector(".image_browser_set_index") const set_btn = container.querySelector(".image_browser_set_index")
let curr_idx let curr_idx

View File

@ -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: if opts.image_browser_use_thumbnail:
image_gallery = [image['name'] for image in image_gallery] image_gallery = [image['name'] for image in image_gallery]
image_gallery[int(num)] = filenames[file_num] image_gallery[int(num)] = filenames[file_num]
return file, tm, num, file, turn_page_switch, info, image_gallery if opts.image_browser_use_thumbnail:
else: return file, tm, num, file, turn_page_switch, info, image_gallery
return file, tm, num, file, turn_page_switch, info 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): def change_dir(img_dir, path_recorder, load_switch, img_path_browser, img_path_depth, img_path):
warning = None warning = None