-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto re-open selected image in gallery when re-generation #2645
Conversation
attach an observer of gallery when generation in progress, if there was a image selected in gallery and gallery has only 1 image, auto re-select/open that image. This matches behavior of prior to Gradio 3.4.1 version bump, is a quality of life feature many people enjoyed.
That doesn't actually match the old behavior, if you had multiple images in the gallery then Gradio would re-open the image with the same index. In other words if you had the second image selected and generated another batch, Gradio would automatically open the second image in the new batch of images. This did feel somewhat odd to me, opening the first image in the batch would have felt a bit more intuitive, but regardless that is how it used to function. |
@EliEron This does make me thinking gradio's change is intentional. In older version, If you selected index 1 in a 2 images batch and change batch size to 1 and re-generate, the preview window will broke due to out of index. However, I did change the code to make it match old behavior (apart from the out of index one), I don't see how it's useful but maybe some people are used to it. |
Yeah I did run into that occasionally, but disabling the persistent gallery state all together feels like a blunt way to fix that issue from Gradio's side. Resetting to the first index or closing it as you do would make more sense to me.
That person would be me, hence why I brought it up 😁. I mostly find it useful because I nearly always do multiple batches, and thus would constantly have to reopen the preview if it returned to thumbnails each time. Also when you are keeping a specific seed and want to quickly see the effect of changing a specific property then being able to look at the preview as it changes from one batch to the next is pretty convenient. Thank you for matching the old behavior, I appreciate it 👍 . |
that is a very, very nice PR |
Thanks for this, but for me I will simply ignore all future updates until Automatic1111 says it has been properly fixed (by gradio?). |
Did gradio to 3.5 fix this issue? |
I don't think so. |
Fix #2326 #2398 #2445
As above tickets reported, after bump version to gradio 3.4.1(d7474a5), selected image no longer stays selected when you re-generate an image. Every thing is reset to small thumbnail mode in gallery, making re-touch image multiple times a pain.
It is not clear to me if it's a gradio bug or intended. A javascript walkaround on webui might be best approach for now.
How it works
This PR attaches an observer to gallery when generation in progress
This matches behavior of prior to Gradio 3.4.1 version bump. Because it's done with observer, user should not notice the preview window ever being closed.
single image:
multiple images: