AlUlkesh / stable-diffusion-webui-images-browser

an images browse for stable-diffusion-webui
623 stars 111 forks source link

Feature request, formatted metadata #252

Closed Wprussell closed 2 months ago

Wprussell commented 3 months ago

It's really difficult to discern details through the current implementation. All text is jumbled together and in one big string. Can we break into separate parts that are clearly marked? For instance, checkpoint, prompt, etc

Thank you

AlUlkesh commented 3 months ago

Here's a first version. I'm sure it can be done prettier, but I hope this helps already.

You can now switch between the previous display and a formatted version: image

There's also a new setting to set the initial display.

Wprussell commented 3 months ago

You are a steely-eyed rocket man! I'll check it out

Cheers!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: AlUlkesh @.> Sent: Saturday, June 1, 2024 9:53:58 AM To: AlUlkesh/stable-diffusion-webui-images-browser @.> Cc: William Russell @.>; Author @.> Subject: Re: [AlUlkesh/stable-diffusion-webui-images-browser] Feature request, formatted metadata (Issue #252)

Here's a first version. I'm sure it can be done prettier, but I hope this helps already.

You can now switch between the previous display and a formatted version: image.png (view on web)https://github.com/AlUlkesh/stable-diffusion-webui-images-browser/assets/99896447/d112d0a6-3d5a-4b83-b75a-c5bc396275e7

There's also a new setting to set the initial display.

— Reply to this email directly, view it on GitHubhttps://github.com/AlUlkesh/stable-diffusion-webui-images-browser/issues/252#issuecomment-2143512553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI22TKEOZDIDEMSF636OSMLZFH4CNAVCNFSM6AAAAABIRRSWGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGUYTENJVGM. You are receiving this because you authored the thread.Message ID: @.***>

Wprussell commented 3 months ago

That's the ticket. But yes, It could be formatted and ordered a little better. Might even enable in .css or Format.txt etc, if it hasn't already been so the user can override the format.

Might I suggest,

Model: VAE: Prompt: Neg Prompt: Sampler: Schedule: Steps: CFG: Seed: Etc....

I pretty sure we are all organizing our work now by Checkpoint, Its like an ocean out there. And Additionally, If we have something like the above (with the inclusion of the prompts) We don't even need to see the jumble)

On a personal note, I really appreciate the your dedication and the turn around.

AlUlkesh commented 3 months ago

Thanks.

I added a small sort function, these are displayed first now:

img_file_info_order = ["Model", "VAE", "Sampler", "Schedule", "Steps", "CFG scale", "Seed", "Size"]

When I have some more time, I could make this also customizable.

Wprussell commented 3 months ago

I was board as well. The following is the formatted function...... Try this

Explanation:

  1. Ordered Keys: The ordered_keys list contains the keys in the required order.
  2. Dictionary Creation: Converts the key/value pairs into a dictionary for easy access. The prompt and negative_prompt are added to the dictionary.
  3. Formatted Output Initialization: Initializes the formatted output.
  4. Iterate and Format Key/Value Pairs:
    • Formats each key by replacing underscores with spaces, capitalizing the first letter, and adding a colon.
    • Appends each formatted key/value pair to img_file_info_formatted with a single space between the key and value.
    • Adds line feeds after "Model" and before "Steps" for clarity.
  5. Update Call: Returns the formatted string to be updated in the interface.

This routine ensures that the keys are displayed in the specified order, with each key/value pair in a separate line, formatted for readability with appropriate line feeds.

def img_file_info_do_format(img_file_info): img_file_info_formatted = "" lines = 6 prompt, negative_prompt, key_value_pairs = wib_db.split_exif_data(img_file_info)

# Define the desired order of keys
ordered_keys = [
    "Model", "prompt", "negative_prompt", "Steps", "Sampler", "Schedule type",
    "CFG scale", "Seed", "Size", "Model hash",
    "Token merging ratio", "NGMS", "Lora hashes", "Pad conds", "Version"
]

# Create a dictionary from the list of key/value pairs
key_value_dict = {k: v for k, v in key_value_pairs}
key_value_dict["prompt"] = prompt
key_value_dict["negative_prompt"] = negative_prompt

# Initialize the formatted output
if key_value_pairs:
    lines = 0

    # Add key/value pairs in the specified order
    for key in ordered_keys:
        if key in key_value_dict:
            # Capitalize and format the key
            formatted_key = key.replace("_", " ").capitalize() + ":"
            value = key_value_dict[key]
            img_file_info_formatted += f"{formatted_key} {value}\n"

            # Add line feeds for clarity
            if key == "Model":
                img_file_info_formatted += "\n"
            elif key == "negative_prompt":
                img_file_info_formatted += "\n"

            lines += 1

return gr.update(value=img_file_info_formatted, lines=lines)

From: AlUlkesh @.> Sent: Saturday, June 1, 2024 1:44 PM To: AlUlkesh/stable-diffusion-webui-images-browser @.> Cc: William Russell @.>; Author @.> Subject: Re: [AlUlkesh/stable-diffusion-webui-images-browser] Feature request, formatted metadata (Issue #252)

Thanks.

I added a small sort function, these are displayed first now:

img_file_info_order = ["Model", "VAE", "Sampler", "Schedule", "Steps", "CFG scale", "Seed", "Size"]

When I have some more time, I could make this also customizable.

— Reply to this email directly, view it on GitHubhttps://github.com/AlUlkesh/stable-diffusion-webui-images-browser/issues/252#issuecomment-2143582330, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI22TKESIVSAX7PKJOZ5PKLZFIXBHAVCNFSM6AAAAABIRRSWGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGU4DEMZTGA. You are receiving this because you authored the thread.Message ID: @.***>

Wprussell commented 3 months ago

The only thing I can't figure out that would be a bonus is to use a non-proportional font, or stick everything in a table. Little bit too much of work for me and CSS stuff

Thanks bunches

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: AlUlkesh @.> Sent: Saturday, June 1, 2024 1:44:03 PM To: AlUlkesh/stable-diffusion-webui-images-browser @.> Cc: William Russell @.>; Author @.> Subject: Re: [AlUlkesh/stable-diffusion-webui-images-browser] Feature request, formatted metadata (Issue #252)

Thanks.

I added a small sort function, these are displayed first now:

img_file_info_order = ["Model", "VAE", "Sampler", "Schedule", "Steps", "CFG scale", "Seed", "Size"]

When I have some more time, I could make this also customizable.

— Reply to this email directly, view it on GitHubhttps://github.com/AlUlkesh/stable-diffusion-webui-images-browser/issues/252#issuecomment-2143582330, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI22TKESIVSAX7PKJOZ5PKLZFIXBHAVCNFSM6AAAAABIRRSWGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGU4DEMZTGA. You are receiving this because you authored the thread.Message ID: @.***>

AlUlkesh commented 3 months ago

Ok, I have now switched to a Gradio component that can display tables and made the sort order customizable:

image

image

Wprussell commented 3 months ago

Perfect

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: AlUlkesh @.> Sent: Sunday, June 2, 2024 1:04:30 AM To: AlUlkesh/stable-diffusion-webui-images-browser @.> Cc: William Russell @.>; Author @.> Subject: Re: [AlUlkesh/stable-diffusion-webui-images-browser] Feature request, formatted metadata (Issue #252)

Ok, I have now switched to a Gradio component that can display tables and made the sort order customizable:

image.png (view on web)https://github.com/AlUlkesh/stable-diffusion-webui-images-browser/assets/99896447/b81fb462-2548-4358-a01b-6632f55bb573

image.png (view on web)https://github.com/AlUlkesh/stable-diffusion-webui-images-browser/assets/99896447/ebfdb7ce-73cb-4898-98eb-298b155bdc26

— Reply to this email directly, view it on GitHubhttps://github.com/AlUlkesh/stable-diffusion-webui-images-browser/issues/252#issuecomment-2143741819, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI22TKHPPGARY35AUSWKUHDZFLGY5AVCNFSM6AAAAABIRRSWGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTG42DCOBRHE. You are receiving this because you authored the thread.Message ID: @.***>