Skip to content

web ui: display in-progress images - #181

Merged
lstein merged 2 commits into
invoke-ai:mainfrom
bakkot:sw-drop
Aug 30, 2022
Merged

web ui: display in-progress images#181
lstein merged 2 commits into
invoke-ai:mainfrom
bakkot:sw-drop

Conversation

@bakkot

@bakkot bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor

Based on #180. Merge that PR first even if you intend to accept this one. Only look at the second commit; the first commit is in #180.

This adds an off-by-default checkbox which lets you see images as they render, at the cost of slowing down generation. Doing this on every step ~doubles the time-to-generate on my machine, so I've made it do every 5th image, which seemed like a good tradeoff.

@lstein lstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Will need some conflict resolution with the recent changes to support streaming of GFPGAN/ESRGAN, but doesn't look too bad. @bakkot drop a comment if you will be doing additional pushes on the branch. Otherwise I can work on it later this afternoon.

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

@lstein I'm happy to take care of the rebase. It looks like #180 was closed without merging, though?

@lstein

lstein commented Aug 29, 2022

Copy link
Copy Markdown
Collaborator

@lstein I'm happy to take care of the rebase. It looks like #180 was closed without merging, though?
That would be an "oops". I forgot to push to origin. Should be there now.

@bakkot
bakkot force-pushed the sw-drop branch 2 times, most recently from 654b65b to c7c7737 Compare August 29, 2022 16:39
@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

@lstein Rebased.

@blessedcoolant

Copy link
Copy Markdown
Collaborator

I am only seeing the very first noisy image and then the final output. It's not streaming every 5th image. Am I missing something here?

<button type="button" id="reset-all">Reset to Defaults</button>
<br>
<label for="progress_images">Display in-progress images (slows down generation):</label>
<input type="checkbox" name="progress_images" id="progress_images">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Quick consistency nitpick, can this be named progress-images?

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.

Sure. The underscore was just for consistency with gfpgan_strength immediately below.

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.

Actually, this file seems to consistently use underscores for names, so I've left it as-is for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@TesseractCat are there still issues, or are we good to go? (I've re-requested a review. Hope that's etiquette.)

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.

@lstein could this get merged as-is, and then @TesseractCat can submit any further style nits in a followup PR? I'd like to stop needing to rebase this PR, and to get #182 in.

Comment thread static/dream_web/index.js
let progressImageEle = document.querySelector('#progress-image');
progressImageEle.src = BLANK_IMAGE_URL;

progressImageEle.style.display = {}.hasOwnProperty.call(formData, 'progress_images') ? 'initial': 'none';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just do formData.hasOwnProperty?

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.

You should never do foo.hasOwnProperty. That will break if foo has an own property named hasOwnProperty, or if it has a null prototype. In this particular instance we know it won't, but this is still the idiomatic way to write this test.

Comment thread ldm/dream/server.py
@@ -102,9 +103,20 @@ def image_done(image, seed, upscaled=False):
{'event':action,'processed_file_cnt':f'{x}/{iterations}'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably should be processed_file_count, also since this is intended to be consumed by JS, maybe this should be processedFileCount.

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.

That's not related to this PR.

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

I am only seeing the very first noisy image and then the final output. It's not streaming every 5th image. Am I missing something here?

Nice catch, seems like something broke in a rebase (or PngWriter changed). Stand by...

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

Ah, it's these lines (I think). I don't know what those are supposed to be doing. @blessedcoolant what was the point of that change? Could it be accomplished in a different way?

@blessedcoolant

Copy link
Copy Markdown
Collaborator

Ah, it's these lines (I think). I don't know what those are supposed to be doing. @blessedcoolant what was the point of that change? Could it be accomplished in a different way?

That is to overwrite the existing image when upscaled if the user does not want 2 images. The stops the unique file name from creating a new file name which inadvertently overwrites the previous file only giving a scaled output.

The streaming is working here though. #182

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

Ah, I was wrong, it was this change, which fails to update the path variable during the loop - so you'll only ever get one file path.

I've pushed a fix for that bug. @blessedcoolant could you see if it works for you now? And @lstein can you confirm that bakkot@d6868bc is a correct change?

@blessedcoolant

Copy link
Copy Markdown
Collaborator

Still broken for me. The intermediate frames are being overwritten so the same file name in the folder. In the other PR, they were being written to different files.

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

@blessedcoolant Hm, did you pull? With the most recent commit, I am again getting files written to different names instead of overwriting.

(The other PR is only working because it hasn't been rebased onto the problematic change.)

@blessedcoolant

Copy link
Copy Markdown
Collaborator

@blessedcoolant Hm, did you pull? With the most recent commit, I am again getting files written to different names instead of overwriting.

(The other PR is only working because it hasn't been rebased onto the problematic change.)

Sorry. That was my bad. I thought I pulled. It's working.

@blessedcoolant blessedcoolant left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does what the PR says it does for this current point of time.

@bakkot

bakkot commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

Ping @lstein - this is ready to go.

@lstein
lstein requested a review from TesseractCat August 30, 2022 03:31
@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

Sorry about all the confusion regarding pngwriter and duplicate files. There was some pretty nasty stuff that happened when we moved from filenames to streaming Images in the WebUI which broke how the post-processing through GFPGAN and ESRGAN worked. It took me a couple hours to figure out what was going on here, but I cleaned up some code and think it is easier to follow now. Suggestions for further simplication most welcome.

@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

Ping @lstein - this is ready to go.

On its way - just checking edge cases.

@lstein
lstein merged commit 186d0f9 into invoke-ai:main Aug 30, 2022
@lstein

lstein commented Aug 30, 2022

Copy link
Copy Markdown
Collaborator

The PR is now in main. This is a fun feature! However, during this morning's testing I did notice one non-blocking issue, which is that when an init_img is provided, the in-progress images are not shown. Instead there is a blank area.

Also, we need to have a user interface element to clear the init_img field in the WebUI. Right now there's no obvious way to do it, though it is possible by resetting everything or opening the file select dialog and then cancelling.

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