Spaces:
Running
Running
FoodDesert
commited on
Commit
•
c8c8a26
1
Parent(s):
5d5efcb
Upload app.py
Browse files
app.py
CHANGED
@@ -75,15 +75,6 @@ than the query "red fox, score:7".
|
|
75 |
The "not-for-all-audience" tag informs users that this tool's text output is derived from e621.net data for tag prediction and completion.
|
76 |
The app will try not to display nsfw tags unless the "Allow NSFW Tags" is checked, but the filter is not perfect.
|
77 |
|
78 |
-
## How is the artist list calculated?
|
79 |
-
|
80 |
-
Each artist is represented by a "pseudo-document" composed of all the tags from their uploaded images, treating these tags similarly to words in a text document.
|
81 |
-
Similarly, when you input a set of tags, the system creates a pseudo-document for your query out of all the tags.
|
82 |
-
It then uses a technique called cosine similarity to compare your tags against each artist's collection, essentially finding which artist's tags are most "similar" to yours.
|
83 |
-
This method helps identify artists whose work is closely aligned with the themes or elements you're interested in.
|
84 |
-
For those curious about the underlying mechanics of comparing text-like data, we employ the TF-IDF (Term Frequency-Inverse Document Frequency) method, a standard approach in information retrieval.
|
85 |
-
You can read more about TF-IDF on its [Wikipedia page](https://en.wikipedia.org/wiki/Tf%E2%80%93idf).
|
86 |
-
|
87 |
## How does the tag corrector work?
|
88 |
|
89 |
We collect the tag sets from over 4 million e621 posts, treating the tag set from each image as an individual document.
|
@@ -98,7 +89,23 @@ Using the same 4 million post dataset, we calculate the conditional probability
|
|
98 |
This is done by creating a co-occurrence matrix from our dataset, which records how frequently each pair of tags appears together across all documents.
|
99 |
By considering the context in which tags are used, we can now not only correct misspellings and rephrasings but also make more contextually relevant suggestions.
|
100 |
The "similarity weight" slider controls how much weight these conditional probabilities are given vs how much weight the FastText similarity model is given when suggesting replacements for invalid tags.
|
101 |
-
A similarity weight slider value of 0 means that only the FastText model's predictions will be used to calculate similarity scores, and a value of 1 means only the conditional probabilities are used (although the FastText model is still used to trim the list of candidates).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
"""
|
103 |
|
104 |
|
@@ -460,7 +467,7 @@ with gr.Blocks() as app:
|
|
460 |
top_artists = gr.Textbox(label="Top Artists", info="These are the artists most strongly associated with your tags. The number in parentheses is a similarity score between 0 and 1, with higher numbers indicating greater similarity.")
|
461 |
dynamic_prompts = gr.Textbox(label="Dynamic Prompts Format", info="For if you're using the Automatic1111 webui (https://github.com/AUTOMATIC1111/stable-diffusion-webui) with the Dynamic Prompts extension activated (https://github.com/adieyal/sd-dynamic-prompts) and want to try them all individually.")
|
462 |
with gr.Column(scale=3):
|
463 |
-
styles = gr.Gallery(label="Styles",
|
464 |
|
465 |
|
466 |
submit_button.click(
|
|
|
75 |
The "not-for-all-audience" tag informs users that this tool's text output is derived from e621.net data for tag prediction and completion.
|
76 |
The app will try not to display nsfw tags unless the "Allow NSFW Tags" is checked, but the filter is not perfect.
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
## How does the tag corrector work?
|
79 |
|
80 |
We collect the tag sets from over 4 million e621 posts, treating the tag set from each image as an individual document.
|
|
|
89 |
This is done by creating a co-occurrence matrix from our dataset, which records how frequently each pair of tags appears together across all documents.
|
90 |
By considering the context in which tags are used, we can now not only correct misspellings and rephrasings but also make more contextually relevant suggestions.
|
91 |
The "similarity weight" slider controls how much weight these conditional probabilities are given vs how much weight the FastText similarity model is given when suggesting replacements for invalid tags.
|
92 |
+
A similarity weight slider value of 0 means that only the FastText model's predictions will be used to calculate similarity scores, and a value of 1 means only the conditional probabilities are used (although the FastText model is still used to trim the list of candidates).
|
93 |
+
|
94 |
+
## How is the artist list calculated?
|
95 |
+
|
96 |
+
Each artist is represented by a "pseudo-document" composed of all the tags from their uploaded images, treating these tags similarly to words in a text document.
|
97 |
+
Similarly, when you input a set of tags, the system creates a pseudo-document for your query out of all the tags.
|
98 |
+
It then uses a technique called cosine similarity to compare your tags against each artist's collection, essentially finding which artist's tags are most "similar" to yours.
|
99 |
+
This method helps identify artists whose work is closely aligned with the themes or elements you're interested in.
|
100 |
+
For those curious about the underlying mechanics of comparing text-like data, we employ the TF-IDF (Term Frequency-Inverse Document Frequency) method, a standard approach in information retrieval.
|
101 |
+
You can read more about TF-IDF on its [Wikipedia page](https://en.wikipedia.org/wiki/Tf%E2%80%93idf).
|
102 |
+
|
103 |
+
## How do the sample images work?
|
104 |
+
|
105 |
+
For each artist in the dataset, we generated a sample image with the model Fluffyrock Unleashed using the prompt "by artist, soyjak, anthro, male, bust portrait, meme, grin".
|
106 |
+
The simplicity of the prompt, the the simplicty of the default style, and the recognizability of the character make it easier to understand how artist names affect generated image styles.
|
107 |
+
The first image returned is a baseline, generated with the same prompt, but with no artist name.
|
108 |
+
You should compare all the images to the first to see how the artist names affect the output.
|
109 |
"""
|
110 |
|
111 |
|
|
|
467 |
top_artists = gr.Textbox(label="Top Artists", info="These are the artists most strongly associated with your tags. The number in parentheses is a similarity score between 0 and 1, with higher numbers indicating greater similarity.")
|
468 |
dynamic_prompts = gr.Textbox(label="Dynamic Prompts Format", info="For if you're using the Automatic1111 webui (https://github.com/AUTOMATIC1111/stable-diffusion-webui) with the Dynamic Prompts extension activated (https://github.com/adieyal/sd-dynamic-prompts) and want to try them all individually.")
|
469 |
with gr.Column(scale=3):
|
470 |
+
styles = gr.Gallery(label="Styles", allow_preview=True, preview=True)
|
471 |
|
472 |
|
473 |
submit_button.click(
|