FoodDesert commited on
Commit
d96b2be
1 Parent(s): e3e6b01

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -1
app.py CHANGED
@@ -6,6 +6,47 @@ import h5py
6
  from io import BytesIO
7
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Load the model and data once at startup
10
  with h5py.File('complete_artist_data.hdf5', 'r') as f:
11
  # Deserialize the vectorizer
@@ -48,7 +89,8 @@ iface = gr.Interface(
48
  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.")
49
  ],
50
  title="Tagset Completer",
51
- description="Enter a list of comma-separated e6 tags"
 
52
  )
53
 
54
  iface.launch()
 
6
  from io import BytesIO
7
 
8
 
9
+ faq_content="""
10
+ # Frequently Asked Questions (FAQs)
11
+
12
+ Technically I am writing this before anyone but me has used the tool, so no one has asked questions yet. But if they did, here are the questions I think they might ask:
13
+
14
+ ## Does input order matter?
15
+
16
+ No
17
+
18
+ ## Should I use underscores in the input tags?
19
+
20
+ It doesn't matter. The application handles tags either way.
21
+
22
+ ## Why are some valid tags marked as "unseen", and why don't some artists ever get returned?
23
+
24
+ Some data is excluded from consideration if it did not occur frequently enough in the sample from which the application makes its calculations.
25
+ If an artist or tag is too infrequent, we might not think we have enough data to make predictions about it.
26
+
27
+ ## Are there any special tags?
28
+
29
+ Yes. We normalized the favorite counts of each image to a range of 0-9, with 0 being the lowest favcount, and 9 being the highest.
30
+ You can include any of these special tags: "score:0", "score:1", "score:2", "score:3", "score:4", "score:5", "score:6", "score:7", "score:8", "score:9"
31
+ in your list to bias the output toward artists with higher or lower scoring images.
32
+
33
+ ## Are there any other special tricks?
34
+
35
+ Yes. If you want to more strongly bias the artist output toward a specific tag, you can just list it multiple times.
36
+ So for example, the query "red fox, red fox, red fox, score:7" will yield a list of artists who are more strongly associated with the tag "red fox"
37
+ than the query "red fox, score:7".
38
+
39
+ ## What calculation is this thing actually performing?
40
+
41
+ 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.
42
+ Similarly, when you input a set of tags, the system creates a pseudo-document for your query out of all the tags.
43
+ 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.
44
+ This method helps identify artists whose work is closely aligned with the themes or elements you're interested in.
45
+ 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.
46
+ You can read more about TF-IDF on its [Wikipedia page](https://en.wikipedia.org/wiki/Tf%E2%80%93idf).
47
+ """
48
+
49
+
50
  # Load the model and data once at startup
51
  with h5py.File('complete_artist_data.hdf5', 'r') as f:
52
  # Deserialize the vectorizer
 
89
  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.")
90
  ],
91
  title="Tagset Completer",
92
+ description="Enter a list of comma-separated e6 tags",
93
+ article=faq_content
94
  )
95
 
96
  iface.launch()