Added artist category choice

This commit is contained in:
AIrjen
2023-04-27 15:06:42 +02:00
parent 956cb11100
commit 9b84cf31ee
5 changed files with 3512 additions and 6 deletions
+14 -4
View File
@@ -59,11 +59,19 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
hybridhumanlist = ["-fictional-", "-nonfictional-"]
# possible?: think about curated artist list?
# create artist list to use in the code, maybe based on category
if(artists != "all" and artists != "none"):
artistlist = artist_category_csv_to_list("artists_and_category",artists)
else:
artistlist = csv_to_list("artists")
artistsplacement = "front"
if(uncommon_dist(insanitylevel) and onlyartists == False):
artistsplacement = "back"
if(artists == "all" and artistsplacement == "front"):
if(artists != "none" and artistsplacement == "front"):
# take 1-3 artists, weighted to 1-2
step = random.randint(0, 1)
end = random.randint(1, insanitylevel3)
@@ -104,7 +112,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
if isweighted == 1:
completeprompt += " ("
completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","")
#completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","")
completeprompt += "art by " + random.choice(artistlist)
if isweighted == 1:
completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")"
@@ -498,7 +507,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
if(artists == "all" and artistsplacement == "back"):
if(artists != "none" and artistsplacement == "back"):
completeprompt += ", "
# take 1-3 artists, weighted to 1-2
step = random.randint(0, 1)
@@ -532,7 +541,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
if isweighted == 1:
completeprompt += " ("
completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","")
#completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","")
completeprompt += "art by " + random.choice(artistlist)
if isweighted == 1:
completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")"
+11
View File
@@ -28,4 +28,15 @@ def csv_to_list(csvfilename):
csvlist.append(row[0])
return csvlist
def artist_category_csv_to_list(csvfilename,category):
csvlist = []
script_dir = os.path.dirname(os.path.abspath(__file__))
full_path = os.path.join(script_dir, "./csvfiles/" )
with open(full_path + csvfilename + ".csv", "r", newline="",encoding="utf8") as file:
reader = csv.DictReader(file, delimiter=",")
for row in reader:
if(row[category] == "1"):
csvlist.append(row["Artist"])
return csvlist
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -19,7 +19,7 @@ steps = 0
while steps < loops:
# build prompt
randomprompt = build_dynamic_prompt(7,"all","all","all")
randomprompt = build_dynamic_prompt(7,"all","all","all", False)
# prompt + size
+1 -1
View File
@@ -10,7 +10,7 @@ from modules.shared import opts, cmd_opts, state
from build_dynamic_prompt import *
subjects = ["all","object","animal","humanoid", "landscape", "concept"]
artists = ["all", "none"]
artists = ["all", "none", "popular", "greg mode", "3D", "abstract", "angular", "anime" ,"architecture", "art nouveau", "art deco", "baroque", "bauhaus", "cartoon", "character", "children's illustration", "cityscape", "clean", "cloudscape", "collage", "colorful", "comics", "cubism", "dark", "detailed", "digital", "expressionism", "fantasy", "fashion", "fauvism", "figurativism", "gore", "graffiti", "graphic design", "high contrast", "horror", "impressionism", "installation", "landscape", "light", "line drawing", "low contrast", "luminism", "magical realism", "manga", "melanin", "messy", "monochromatic", "nature", "nudity", "photography", "pop art", "portrait", "primitivism", "psychedelic", "realism", "renaissance", "romanticism", "scene", "sci-fi", "sculpture", "seascape", "space", "stained glass", "still life", "storybook realism", "street art", "streetscape", "surrealism", "symbolism", "textile", "ukiyo-e", "vibrant", "watercolor", "whimsical"]
imagetypes = ["all", "all - force multiple", "photograph", "octane render","digital art","concept art", "painting", "portrait", "anime key visual", "only other types"]
promptmode = ["at the back", "in the front"]
promptcompounder = ["1", "2", "3", "4", "5"]