ahgsql / StyleSelectorXL

This repository contains a Automatic1111 Extension allows users to select and apply different styles to their inputs using SDXL 1.0.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting Style

barepixels opened this issue · comments

Can someone write a small windows app that can:

import a style.json
drag and drop rearrange the order of style
save as a new json file

In other words, drag a specific style such as "Artstyle Pop Art" and move it to the 3rd position from the top. Reordering then export

From what I can tell the sorting does not follow the JSON file. The JSON file has a good bit of random ordering but the extension always shows the list in alphabetical order. The option to rearrange the styles would have to be coded into the PY script file.

The easiest way would be to edit the JSON file and give your favorite styles number prefix for sorting.

For example, change:
{
"name": "Pop Art",
"prompt": "Pop Art style {prompt} . Bright colors, bold outlines, popular culture themes, ironic or kitsch",
"negative_prompt": "ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, minimalist"
},

to:
{
"name": "001_Pop Art",
"prompt": "Pop Art style {prompt} . Bright colors, bold outlines, popular culture themes, ironic or kitsch",
"negative_prompt": "ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, minimalist"
},

you could literally set as many as you want to move to the top or re-arrange all of them this way.

Just had a discussion with GPT about two options within the gradio interface:

  1. Enable a user customizable list with styles that can be dragged to any order.
  2. Enable a Favorites feature where user could mark items as favorite and they would be displayed at the top.

Option 1 - It gave a long breakdown of what would be involved and finished with this:

"This is a non-trivial task that involves both frontend and backend development, as well as data management. It would require a fair amount of custom code. Using a web framework like Flask or Django can help with the backend, while JavaScript libraries like jQuery UI or react-beautiful-dnd can assist with frontend drag-and-drop functionality.

To implement such a feature, you may want to consider the complexity of your project, your development team's expertise, and whether it's worth the effort for the specific use case of your Gradio interface. If it's too complex to implement, the "Favorites" feature you mentioned (storing a subset of items at the top) might be a more manageable alternative and still provide users with a level of customization."

Option 2 -
To implement a "Favorites" feature in your Gradio interface, you can modify the existing code to allow users to mark certain styles as favorites and display them separately or at the top of the list. Here's a general outline of how you can add this feature:

[DETAILS TOO LONG FOR HERE]
[4 sections with over 100 lines of new code]

With these modifications, users can mark their favorite styles using checkboxes, and the Gradio interface will display the favorite styles accordingly. This should allow you to implement a 'Favorites' feature in your Gradio interface.

Thank you @mbloflin

Am going to go with favorite styles number prefix for favorites and ranking, then use a site like this to sort https://codeshack.io/json-sorter/ by "name" and move them to the top