update gradio

This commit is contained in:
Vladimir Mandic
2023-05-18 10:41:24 -04:00
parent df1fae7248
commit 8b682183e3
3 changed files with 25 additions and 13 deletions
+22 -11
View File
@@ -1,7 +1,27 @@
/* global gradioApp, onUiUpdate */
// attaches listeners to the txt2img and img2img galleries to update displayed generation param text when the image changes
let txt2img_gallery; let img2img_gallery; let
modal;
function attachGalleryListeners(tab_name) {
const gallery = gradioApp().querySelector(`#${tab_name}_gallery`);
gallery?.addEventListener('click', () => setTimeout(() => {
gradioApp()
.getElementById(`${tab_name}_generation_info_button`)
?.click();
}, 500));
gallery?.addEventListener('keydown', (e) => {
if (e.keyCode == 37 || e.keyCode == 39) { // left or right arrow
gradioApp()
.getElementById(`${tab_name}_generation_info_button`)
.click();
}
});
return gallery;
}
let txt2img_gallery;
let img2img_gallery;
let modal;
onUiUpdate(() => {
if (!txt2img_gallery) txt2img_gallery = attachGalleryListeners('txt2img');
if (!img2img_gallery) img2img_gallery = attachGalleryListeners('img2img');
@@ -19,12 +39,3 @@ let modalObserver = new MutationObserver((mutations) => {
});
});
function attachGalleryListeners(tab_name) {
gallery = gradioApp().querySelector(`#${tab_name}_gallery`);
gallery?.addEventListener('click', () => gradioApp().getElementById(`${tab_name}_generation_info_button`).click());
gallery?.addEventListener('keydown', (e) => {
if (e.keyCode == 37 || e.keyCode == 39) // left or right arrow
{ gradioApp().getElementById(`${tab_name}_generation_info_button`).click(); }
});
return gallery;
}
+1 -1
View File
@@ -457,7 +457,7 @@ def reload_model_weights(sd_model=None, info=None):
current_checkpoint_info = None
else:
current_checkpoint_info = sd_model.sd_checkpoint_info
if sd_model.sd_model_checkpoint == checkpoint_info.filename:
if checkpoint_info is not None and sd_model.sd_model_checkpoint == checkpoint_info.filename:
return
if shared.cmd_opts.lowvram or shared.cmd_opts.medvram:
lowvram.send_everything_to_cpu()
+2 -1
View File
@@ -51,9 +51,10 @@ accelerate==0.18.0
opencv-python==4.7.0.72
diffusers==0.16.1
einops==0.4.1
gradio==3.29.0
gradio==3.31.0
numexpr==2.8.4
numpy==1.24.3
numba==0.57.0
pandas==1.5.3
protobuf==3.20.3
pytorch_lightning==1.9.4