Logic for dynamic subject in prompts
This commit is contained in:
+20
-10
@@ -211,9 +211,6 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
templatemode = False
|
||||
if(common_dist(insanitylevel)):
|
||||
templatemode = True
|
||||
civitaitemplate = csv_to_list("civitai", antilist,"./csvfiles/templates/")
|
||||
|
||||
completeprompt = random.choice(civitaitemplate)
|
||||
|
||||
|
||||
# main stuff
|
||||
@@ -410,15 +407,10 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
|
||||
|
||||
|
||||
|
||||
completeprompt = ""
|
||||
|
||||
|
||||
# Start of building prompt
|
||||
if(not templatemode):
|
||||
completeprompt = ""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
promptstocompound = int(promptcompounderlevel)
|
||||
compoundcounter = 0
|
||||
@@ -438,6 +430,24 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
|
||||
completeprompt += ", "
|
||||
|
||||
if(templatemode==True):
|
||||
templatelist = csv_to_list("templates", antilist,"./csvfiles/templates/",0,";",True)
|
||||
|
||||
templateprompts = [templateprompt[0] for templateprompt in templatelist]
|
||||
templatewebsites = [templatewebsite[1] for templatewebsite in templatelist]
|
||||
templatewebsitesources = [templatewebsitesource[2] for templatewebsitesource in templatelist]
|
||||
templatesubjecttypes = [templatesubjecttype[3] for templatesubjecttype in templatelist]
|
||||
templatesubjects= [templatesubject[4] for templatesubject in templatelist]
|
||||
|
||||
# choose the template
|
||||
chosentemplate = random.choice(templateprompts)
|
||||
templateindex = templateprompts.index(chosentemplate)
|
||||
|
||||
if(givensubject==""):
|
||||
completeprompt += chosentemplate.replace("-subject-",templatesubjects[templateindex] )
|
||||
else:
|
||||
completeprompt += chosentemplate.replace("-subject-",givensubject )
|
||||
|
||||
|
||||
# custom prefix list
|
||||
for i in range(2):
|
||||
|
||||
+28
-19
@@ -18,7 +18,7 @@ def add_from_csv(completeprompt, csvfilename, addcomma, prefix, suffix):
|
||||
return ", ".join([completeprompt,addtoprompt])
|
||||
return " ".join([completeprompt,addtoprompt])
|
||||
|
||||
def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip=0, delimiter=";"):
|
||||
def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip=0, delimiter=";", listoflistmode = False):
|
||||
userfilesdirectory = "./userfiles/"
|
||||
userfileaddonname = csvfilename + "_addon.csv"
|
||||
userfilereplacename = csvfilename + "_replace.csv"
|
||||
@@ -39,35 +39,43 @@ def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip
|
||||
if(os.path.isfile(full_path + csvfilename + ".csv")):
|
||||
with open(full_path + csvfilename + ".csv", "r", newline="",encoding="utf8") as file:
|
||||
reader = csv.reader(file, delimiter=delimiter)
|
||||
for row in reader:
|
||||
value = row[0]
|
||||
if(value.lower().strip() not in antilist):
|
||||
if(lowerandstrip == 1):
|
||||
csvlist.append(row[0].lower().strip())
|
||||
csvlist.append(row[0])
|
||||
|
||||
# do the add ons!
|
||||
if(directory=="./csvfiles/" or directory=="./csvfiles/special_lists/"):
|
||||
if(os.path.isfile(userfilesfolder + csvfilename + "_addon" + ".csv")):
|
||||
with open(userfilesfolder + csvfilename + "_addon" + ".csv", "r", newline="",encoding="utf8") as file:
|
||||
reader = csv.reader(file, delimiter=",")
|
||||
if(listoflistmode==True):
|
||||
csvlist = list(reader)
|
||||
else:
|
||||
for row in reader:
|
||||
value = row[0]
|
||||
if(value.lower().strip() not in antilist):
|
||||
if(lowerandstrip == 1):
|
||||
csvlist.append(row[0].lower().strip())
|
||||
csvlist.append(row[0])
|
||||
|
||||
# do the add ons!
|
||||
if(directory=="./csvfiles/" or directory=="./csvfiles/special_lists/"):
|
||||
if(os.path.isfile(userfilesfolder + csvfilename + "_addon" + ".csv")):
|
||||
with open(userfilesfolder + csvfilename + "_addon" + ".csv", "r", newline="",encoding="utf8") as file:
|
||||
reader = csv.reader(file, delimiter=",")
|
||||
if(listoflistmode==True):
|
||||
csvlist.append(list(reader))
|
||||
else:
|
||||
for row in reader:
|
||||
value = row[0]
|
||||
if(value.lower().strip() not in antilist):
|
||||
if(lowerandstrip == 1):
|
||||
csvlist.append(row[0].lower().strip())
|
||||
csvlist.append(row[0])
|
||||
|
||||
|
||||
# remove duplicates, but check only for lowercase stuff
|
||||
deduplicated_list = []
|
||||
lowercase_elements = set()
|
||||
|
||||
for element in csvlist:
|
||||
lowercase_element = element.lower()
|
||||
if lowercase_element not in lowercase_elements:
|
||||
lowercase_elements.add(lowercase_element)
|
||||
deduplicated_list.append(element)
|
||||
if(listoflistmode==False):
|
||||
for element in csvlist:
|
||||
lowercase_element = element.lower()
|
||||
if lowercase_element not in lowercase_elements:
|
||||
lowercase_elements.add(lowercase_element)
|
||||
deduplicated_list.append(element)
|
||||
else:
|
||||
deduplicated_list = csvlist
|
||||
|
||||
return deduplicated_list
|
||||
|
||||
@@ -83,3 +91,4 @@ def artist_category_csv_to_list(csvfilename,category):
|
||||
return csvlist
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
a closeup portrait of a -descriptor- -job-, -hairstyle- hair, -outfit-, amazing body, pronounced -genderdescription- feature, busty, kitchen, -haircolor- hair, freckles, flirting with camera; deliberate; official
|
||||
a -descriptor- baby -animal- made out of -material-, (cyborg:1.1), ([tail | detailed wire]:1.3), (intricate details), hdr, (intricate details, hyperdetailed:1.2), cinematic shot, vignette, centered; deliberate; official
|
||||
-accessory-, -culture- era, cinematography, intricately detailed, crafted, meticulous, magnificent, maximum details, extremely hyper aesthetic; deliberate; official
|
||||
a -manwoman-, wearing a -accessory-, -food- in her hands, school, indoors, (soothing tones:1.25), (hdr:1.25), (artstation:1.2), dramatic, (intricate details:1.14), (hyperrealistic 3d render:1.16), (filmic:0.55), (rutkowski:1.1), (faded:1.3); deliberate; official
|
||||
-human- with -accessory-, natural skin texture, 24mm, 4k textures, soft cinematic light, adobe lightroom, photolab, hdr, intricate, elegant, highly detailed, sharp focus, ((((cinematic look)))), soothing tones, insane details, intricate details, hyperdetailed, low contrast, soft cinematic light, dim colors, exposure blend, hdr, faded; deliberate; official
|
||||
a portrait of a laughing, -descriptor-, muscle, -humanoid-, elder, (hdr:1.28), -hairstyle-, hyperdetailed, cinematic, warm lights, intricate details, hyperrealistic, dark radial background, (muted colors:1.38), (-colorscheme- colors:1.2); deliberate; official
|
||||
a young -manwoman-, -location-, -mood-, -hairstyle-, (hdr:1.3), (-colorscheme-:1.2), dramatic, complex background, cinematic, filmic, (rutkowski, artstation:0.8), soaking wet; deliberate; official
|
||||
a [-building- : (-food-:1.3) : 7], complex; deliberate; official
|
||||
a portrait photo of a black -manwoman-, smiling, -accessory-, -color- dreads, (-outfit-:1.3), -culture- -outfit-, pronounced -genderdescription- feature, insane details, intricate details, hyperdetailed, complex background, -building-, indoors; deliberate; official
|
||||
a -job-, pinup, art style, kodak portra 400, cinematic, (-mood-:0.6), (closeup:0.8); deliberate; official
|
||||
drunk, -descriptor- -fictional-, muddy, crowded bottles bar, intricate details, hdr, intricate details, hyperdetailed, cinematic, dark shot, -colorscheme- colors, film grainy, soothing tones, muted colors, -colorscheme-; deliberate; official
|
||||
end of the world, epic realistic, (hdr:1.4), (-colorscheme- colors:1.4), -conceptsuffix-, freezing, -descriptor-, neutral colors, night, screen space refractions, (intricate details), (intricate details, hyperdetailed:1.2), artstation, cinematic shot, vignette, complex background, buildings, snowy; deliberate; official
|
||||
a -manwoman-, (-material- skin cracked:1.4), (intricate details:1.22), hdr, (intricate details, hyperdetailed:1.2), whole body, cinematic, intense, cinematic composition, cinematic lighting, (rim lighting:1.3), -colorscheme-, focused; deliberate; official
|
||||
a 42 yo -job-, smiling, (-food- bar:1.2), (-color- apron:0.9), cook hat, artstation, (epic realistic:1.2), (hdr:1.3), (dark shot:0.7), intricate details, [[rutkowski]], intricate, cinematic, detailed; deliberate; official
|
||||
-artmovement-, a -manwoman- -job- covered in -color- paint; deliberate; gallery
|
||||
|
@@ -0,0 +1,15 @@
|
||||
"a closeup portrait of a -descriptor- -subject-, -hairstyle- hair, -outfit-, amazing body, pronounced -genderdescription- feature, busty, kitchen, -haircolor- hair, freckles, flirting with camera"; deliberate; official; humanoid; -job-
|
||||
a -descriptor- baby -subject- made out of -material-, (cyborg:1.1), ([tail | detailed wire]:1.3), (intricate details), hdr, (intricate details, hyperdetailed:1.2), cinematic shot, vignette, centered; deliberate; official; animal; -animal-
|
||||
-subject-, -culture- era, cinematography, intricately detailed, crafted, meticulous, magnificent, maximum details, extremely hyper aesthetic; deliberate; official; object; -accessory-
|
||||
a -subject-, wearing a -accessory-, -food- in her hands, school, indoors, (soothing tones:1.25), (hdr:1.25), (artstation:1.2), dramatic, (intricate details:1.14), (hyperrealistic 3d render:1.16), (filmic:0.55), (rutkowski:1.1), (faded:1.3); deliberate; official; humanoid; -manwoman-
|
||||
-subject- with -accessory-, natural skin texture, 24mm, 4k textures, soft cinematic light, adobe lightroom, photolab, hdr, intricate, elegant, highly detailed, sharp focus, ((((cinematic look)))), soothing tones, insane details, intricate details, hyperdetailed, low contrast, soft cinematic light, dim colors, exposure blend, hdr, faded; deliberate; official; humanoid; -human-
|
||||
a portrait of a laughing, -descriptor-, muscle, -subject-, elder, (hdr:1.28), -hairstyle-, hyperdetailed, cinematic, warm lights, intricate details, hyperrealistic, dark radial background, (muted colors:1.38), (-colorscheme- colors:1.2); deliberate; official; humanoid; -humanoid-
|
||||
a young -subject-, -location-, -mood-, -hairstyle-, (hdr:1.3), (-colorscheme-:1.2), dramatic, complex background, cinematic, filmic, (rutkowski, artstation:0.8), soaking wet; deliberate; official; humanoid; -manwoman-
|
||||
a [-subject- : (-food-:1.3) : 7], complex; deliberate; official; object; -building-
|
||||
a portrait photo of a black -subject-, smiling, -accessory-, -color- dreads, (-outfit-:1.3), -culture- -outfit-, pronounced -genderdescription- feature, insane details, intricate details, hyperdetailed, complex background, -building-, indoors; deliberate; official; humanoid; -manwoman-
|
||||
a -subject-, pinup, art style, kodak portra 400, cinematic, (-mood-:0.6), (closeup:0.8); deliberate; official; humanoid; -job-
|
||||
drunk, -descriptor- -subject-, muddy, crowded bottles bar, intricate details, hdr, intricate details, hyperdetailed, cinematic, dark shot, -colorscheme- colors, film grainy, soothing tones, muted colors, -colorscheme-; deliberate; official; humanoid; -fictional-
|
||||
-subject-, epic realistic, (hdr:1.4), (-colorscheme- colors:1.4), -conceptsuffix-, freezing, -descriptor-, neutral colors, night, screen space refractions, (intricate details), (intricate details, hyperdetailed:1.2), artstation, cinematic shot, vignette, complex background, buildings, snowy; deliberate; official; concept; end of the world
|
||||
a -subject-, (-material- skin cracked:1.4), (intricate details:1.22), hdr, (intricate details, hyperdetailed:1.2), whole body, cinematic, intense, cinematic composition, cinematic lighting, (rim lighting:1.3), -colorscheme-, focused; deliberate; official; humanoid; -manwoman-
|
||||
a 42 yo -subject-, smiling, (-food- bar:1.2), (-color- apron:0.9), cook hat, artstation, (epic realistic:1.2), (hdr:1.3), (dark shot:0.7), intricate details, [[rutkowski]], intricate, cinematic, detailed; deliberate; official; humanoid; -job-
|
||||
-artmovement-, a -subject- -job- covered in -color- paint; deliberate; gallery; humanoid; -manwoman-
|
||||
|
+1
-1
@@ -35,4 +35,4 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im
|
||||
print("")
|
||||
print("All done!")
|
||||
|
||||
generateprompts(10,7,"all","all","all",False,"","","")
|
||||
generateprompts(10,7,"all","all","all",False,"","","PREFIXPROMPT" ,"SUFFIXPROMPT","",1,"","HELLO")
|
||||
Reference in New Issue
Block a user