corbin-hayden13 / SD-Lora-Tagger

A Search Engine For All Your Local Extra Networks (in AUTOMATIC1111/stable-diffusion-webui and vladmandic/automatic)
MIT License
11 stars 2 forks source link

[Suggestion]: Restructuring tags #10

Open Cruxial0 opened 4 months ago

Cruxial0 commented 4 months ago

First off, good work on this extension. I was going to work on this extension too, but I got stuck on "overriding" the extra_networks search. Good job on figuring that one out!

That being said, there are a few things I'd like to suggest.

Firstly, I think editing tags should be done on a tag basis instead of on a model basis. What I mean by that is instead of having to add tags to each specific model through the tag editor, I think it would be better to add models to the tags. My thought was replacing all individual text files in each directory with a single json file including information about tags and which models are assigned to them. Something like this would do the trick:

{
    "tag_1": {
        "description": "",
        "models": [
            "model_1",
            "model_2",
            "model_3"
        ]
    },
    "tag_2": {
        "description": "",
        "models": [
            "model_1"
        ]
    },
    "tag_3": {
        "description": "",
        "models": [
            "model_1",
            "model_3"
        ]
    }
}

Secondly, I'd like to suggest adding a "tag group" feature. Similar to how booru uses 'rating:safe', 'rating:sensitive', etc.. I think it would be nice to include such a feature in this extension. The way I imagined it is having a second panel under the already existing tag editor panel where you can define groups and their members, alongside a color code which can be used to display these tags. This is more of a visual change, but something I think would be nice to incorporate none the less. Behold my sketch made in paint: image In this example, 'Character', 'Style', and 'Concept' all belong to the same tag group, shown by their colors being the same. The '+' button can be used to add tags via a drop-down later on. (this sketch is designed for A1111, not sure how it would work in SDNext or other distributions)

corbin-hayden13 commented 4 months ago

Absolutely, let's do it! I really like the idea of the json file, my original implementation was due to me not having planned to add the tag editor panel, so I wanted the user to be able to easily organize and add tags without having to be familiar with any other type of file format. Now that the tag editor is implemented, lets change the file to one JSON file. I'm using a dictionary format internally because at the time of implementation I was unsure of how the extra network search worked and thought I had to reimplement it myself, so I created a dict with tags as keys and a list of file names as the values, so I completely agree with that restructuring.

I'm not quite sure what your vision is for the "tag group" feature UI as I'm not super huge on making UI's, but what do you think of a backend of this for the file structure?

{
    "group_1": {
        "description": "",
        "tags": [
            "tag_1",
            "tag_2",
            "tag_3"
        ]
    }
    "tag_1": {
        "description": "",
        "models": [
            "model_1",
            "model_2",
            "model_3"
        ]
    },
    "tag_2": {
        "description": "",
        "models": [
            "model_1"
        ]
    },
    "tag_3": {
        "description": "",
        "models": [
            "model_1",
            "model_3"
        ]
    }
}

Also, I added you to the repository as you're more than welcome to help develop the extension!

Cruxial0 commented 4 months ago

Thanks for the contributor rights!

I wanna experiment a bit with the tag groups before making any further statements. For the json, it seems it would require some fundamental restructuring, I'm currently experimenting a bit on my fork. I'll let you know when I make some progress.

corbin-hayden13 commented 4 months ago

Sounds good👍