diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-05 20:08:06 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-05 20:08:06 +0000 |
commit | b6763fb8847df5a5678f37137e7a702569e5c925 (patch) | |
tree | a535916207766972b929de713c6d3bb1f2a2f2d8 /modules/artists.py | |
parent | f5563853b83aa8fd60484af1c0d6a9691c887d25 (diff) | |
download | stable-diffusion-webui-gfx803-b6763fb8847df5a5678f37137e7a702569e5c925.tar.gz stable-diffusion-webui-gfx803-b6763fb8847df5a5678f37137e7a702569e5c925.tar.bz2 stable-diffusion-webui-gfx803-b6763fb8847df5a5678f37137e7a702569e5c925.zip |
added random artist button
added a setting for padding when doing inpaint at original resolution
Diffstat (limited to 'modules/artists.py')
-rw-r--r-- | modules/artists.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/artists.py b/modules/artists.py new file mode 100644 index 00000000..3612758b --- /dev/null +++ b/modules/artists.py @@ -0,0 +1,25 @@ +import os.path
+import csv
+from collections import namedtuple
+
+Artist = namedtuple("Artist", ['name', 'weight', 'category'])
+
+
+class ArtistsDatabase:
+ def __init__(self, filename):
+ self.cats = set()
+ self.artists = []
+
+ if not os.path.exists(filename):
+ return
+
+ with open(filename, "r", newline='', encoding="utf8") as file:
+ reader = csv.DictReader(file)
+
+ for row in reader:
+ artist = Artist(row["artist"], float(row["score"]), row["category"])
+ self.artists.append(artist)
+ self.cats.add(artist.category)
+
+ def categories(self):
+ return sorted(self.cats)
|