Skip to content

Add a "History" tab to manage previously generated images conveniently#2267

Closed
yfszzx wants to merge 0 commit into
AUTOMATIC1111:masterfrom
yfszzx:master
Closed

Add a "History" tab to manage previously generated images conveniently#2267
yfszzx wants to merge 0 commit into
AUTOMATIC1111:masterfrom
yfszzx:master

Conversation

@yfszzx
Copy link
Copy Markdown
Contributor

@yfszzx yfszzx commented Oct 11, 2022

Last closed PR is here

Compared with the previous version, the following changes have been made:

  1. Replace tab as 4 spaces indentation. Fix the indents also fix the double indents to be single ones.
  2. Removed unneeded prints
  3. Remove jquery framework
  4. Change the way to delete files, making deleting files very fast
  5. Show output directory for extras
    About 500 images in directories when I tested, , but it doesn't matter, the browser only load 48 images every page
    images in subdirectories will be added next step

——————————————————————————————————

This pull request is trying to build a tab browser of previous pictures in output directory for txt2img and img2img. We can easily browse the previously generated images, display the image generation information in PNG meta, push the image information to "txt2img" or "img2img", or delete the images we no longer need.

I try my best to encapsulate the new code independently to avoid affecting other functions of the project .
To facilitate the operation of HTML controls,I import jQuery Framework in the js script.

OS: both Win10, and Ubuntu Server
Browser Chrome,
Graphics card NVIDIA RTX 2080ti 11GB

@SafentisFox
Copy link
Copy Markdown
Contributor

Are you using gradio gallery to show the images?

Doesn't gradio severely slow down as high amounts of images are shown in the gallery? At least that's what I noticed when generating images. (High amounts being like >10 and getting into 20s and 30s)

@yfszzx
Copy link
Copy Markdown
Contributor Author

yfszzx commented Oct 11, 2022

Are you using gradio gallery to show the images?

Doesn't gradio severely slow down as high amounts of images are shown in the gallery? At least that's what I noticed when generating images. (High amounts being like >10 and getting into 20s and 30s)

yes, I use gradio gallery, but I didn't encounter such a problem,It takes about 2 seconds to load 48 pictures on my computer

Copy link
Copy Markdown

@moreRGB moreRGB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not a project collaborator, but i would like this get merged. the js code could be a little bit improved.

Comment thread style.css
filter: invert();
mix-blend-mode: multiply;
pointer-events: none;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary diff

Comment thread javascript/images_history.js Outdated

img_num = buttons.length / 2
if (img_num == 1){
setTimeout(function(tabname){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intendation

Comment thread javascript/images_history.js Outdated
buttons = gradioApp().querySelectorAll('#' + tab + '_images_history .gallery-item')
buttons.forEach(function(bnt){
bnt.addEventListener('click', images_history_button_actions, true)
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent usage of ;

Comment thread javascript/images_history.js Outdated
if (!this.classList.contains("transform")){
gallery = this.parentElement
while(!gallery.classList.contains("images_history_gallery")){gallery = gallery.parentElement}
buttons = gallery.querySelectorAll(".gallery-item")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would strongly advice against declaring variables implicitly

Comment thread javascript/images_history.js Outdated
})

img_num = buttons.length / 2
if (img_num == 1){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use ===

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'm good at python, but not familiar with js.Thank you for your guidance. I will improve the code soon .

@evanjs
Copy link
Copy Markdown

evanjs commented Oct 11, 2022

Are you using gradio gallery to show the images?

Doesn't gradio severely slow down as high amounts of images are shown in the gallery? At least that's what I noticed when generating images. (High amounts being like >10 and getting into 20s and 30s)

This might have been resolved with gradio-app/gradio#2265

@evanjs
Copy link
Copy Markdown

evanjs commented Oct 11, 2022

Note: this point from the last PR is still relevant/has yet to be addressed.

PermissionError: [Errno 13] Permission denied: 'outputs\\img2img-images\\7460a6fa'

Permission denied: actually means any of: You tried to read or write a file which already exists but is a folder ...


It seems like this PR does not account for nested folders, and expects the default directory name pattern of [prompt_words].

I guess this answers auto's earlier question:

was this tested on images in subdirectories? There is an option to save images to subdirs, for example I save all mine to directories with current date, so I have stable-diffusion-webui/outputs/txt2img-images/2022-10-10/00017-3508344613.png.


Edit:
If I understand correctly, it looks like this has already been acknowledged 👍

images in subdirectories will be added next step

@yfszzx
Copy link
Copy Markdown
Contributor Author

yfszzx commented Oct 11, 2022

i'm not a project collaborator, but i would like this get merged. the js code could be a little bit improved.

Thanks, I'm good at python, but not familiar with js.Thank you for your guidance. I will improve the code soon .

@yfszzx yfszzx closed this Oct 12, 2022
@yfszzx yfszzx mentioned this pull request Oct 12, 2022
Atry pushed a commit to Atry/stable-diffusion-webui that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants