Automaticism / Promptvision

Local viewer for Stable Diffusion generated images built with CustomTkinter. Gallery view of selected folder. Autodetect newly generated images.
MIT License
81 stars 9 forks source link

Dynamic Prompts Support + Minor Issues Reporting #14

Closed Daniel-Poke closed 1 year ago

Daniel-Poke commented 1 year ago

Hey man, sorry to throw out your issue template, bit easier just to speak candidly here since there's kind of a few things I wanted to mention and I didn't want to clutter your Issues tab.


Firstly, nice job on the web app!

If you stick with this and keep improving it I think it'll be a really great tool.

Actual Feature Request

The main point of this Feature Request is to get Dynamic Prompts support added in. As one of the pain points of Dynamic Prompts is that the syntax you use __wildcard_name__ will get converted into the prompt value when saved to metadata, for example __hair__ might become straight blue hair. To assist with reusing prompts you can enable a setting to embed Template and Negative Template in the EXIF data.

Herein lies the problem...

If you have an image that uses this EXIF data, because your code assumes anything that isn't one of the expected tag name: is the positive prompt, it means the template metadata gets swapped in here instead. Namely the very last unexpected tag which is the negative one. See the blue outlined section.

image

Sampler Regex

Next, this is more of a bug than anything, your Regex for parsing the tags kinda dies on certain samplers. See the green outline above. I am actually using DPM++ SDE Karras. I used this Regex: ([\w\s]+):\s([\w\s\+\-\.]+)(?:,\s)? when I was playing around in my fork of your repo. That will match the tag as [0] and the value as [1].

Template Support & Correct Positive Prompt

To get around my templates getting picked up erroneously I also did something similar to this:

for i, key_value in enumerate(exif_data['parameters'].split('\n')):
    if i == 1 :
        parsed_data['Positive prompt'] = key_value

I think assuming the first one is always the positive prompt is fine... there's not much to work with is there? Kind of wish they had a prefix for it but oh well.

Model Hash Format

And this is more a minor request but it'd be nice if in the UI you combined the model name and hash like the UI does in Automatic1111, makes copy pasting the model into XYZ plot easier if you have a crapton of models and don't want to click the autofill button then manually delete everything else.

E.g. model my_model and hash abcd1234 is written as my_model [abcd1234].


Here's what it ends up looking like if you implement some of these fixes and also have the lesser used tags only appear if they contain a value.

image

Final Comments

I'd love it if you could add in Dynamic Prompt support in such a way that it only appears if the EXIF data includes it, as to not clutter your UI for others. If you haven't already used it, give it a shot it's cool as hell.

There's a few other things like monitoring changes in the folder that need improving but hey, one thing at a time.

I'm not holding my breath for any of these changes so you can close this feature request if you don't care much for Dynamic Promtps.

Keep up the good work!

Automaticism commented 1 year ago

I think assuming the first one is always the positive prompt is fine... there's not much to work with is there? Kind of wish they had a prefix for it but oh well.

I'll have to double check this since sometimes if you have an image with missing positive prompts there might be some key issue.

Re: dyanmic prompts - will the template also add "Positive Template" when you use that? And model + model hash was a nice idea. I haven't tried to use that with xyz prompts yet, that is a cool feature.

and also have the lesser used tags only appear if they contain a value.

Which tags are you thinking of?

There's a few other things like monitoring changes in the folder that need improving but hey, one thing at a time.

This I am absolutely thinking of since I've been thinking about all the requests for SD webui plugin integration and yes, I am considering adding that, but I like having the standalone program as well. Today I read a cool idea with regards to Comfy UI where someone had an upscaling pipeline where they scaled an image up with 256 pixels each step and reduced the noise every step. Therefore it will make sense to update contents in Promptvision dynamically when you are generating new contents. (Which you should be able to drag into SD webui / Comy UI etc)

Currently it's easy to use Promptvision as a companion for e.g. CivitAI when you are creating new models since you can just drag images directly from Promptvision to CivitAI and it uploads without you have to look it up in a folder and such if you use typical other image viewers.

To be able to use it more efficiently with lots of subdirectories and such I'll have to come up with a neat folder browsing / filtering. Maybe I'll have to take inspiration from the simpler design of e.g. Finder in MacOS: Parent folder>Subfolder>Subfolder And make it easily clickable to sort and show just the images in Parent folder>Subfolder>Subfolder.

Daniel-Poke commented 1 year ago

I'll have to double check this since sometimes if you have an image with missing positive prompts there might be some key issue.

Yeah, there's no perfect solution here I feel. Not unless they add in a tag clearly for positive prompt

Which tags are you thinking of?

I don't know about your generations but mine basically never had Eta, Hashes, Postprocessing or Extras. Anything that isn't always there should have either a settings toggle or autohide to keep space free for other things, like the DP Templates 😄

To be able to use it more efficiently with lots of subdirectories and such I'll have to come up with a neat folder browsing / filtering. Maybe I'll have to take inspiration from the simpler design of e.g. Finder in MacOS: Parent folder>Subfolder>Subfolder And make it easily clickable to sort and show just the images in Parent folder>Subfolder>Subfolder.

Yeah sounds like a lot of work. Would be pretty handy though.

Anyway, good luck with it man, can close this one out now if you're aware of all the issues mentioned.

Automaticism commented 1 year ago

Fields are hidden now if they don't contain anything. If you are missing some fields let me know so I'll add them to the dataset.

Automaticism commented 1 year ago

Regex reworked in #17. Not tested with dynamic prompts template embedding. Might look into it in the future.

Currently it's being rewritten into Streamlit.