started refactoring
This commit is contained in:
+96
-54
@@ -24,6 +24,63 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
artistmode = "normal"
|
||||
insideshot = 0
|
||||
|
||||
|
||||
# build all lists here
|
||||
|
||||
colorlist = csv_to_list("colors")
|
||||
animallist = csv_to_list("animals")
|
||||
materiallist = csv_to_list("materials")
|
||||
objectlist = csv_to_list("objects")
|
||||
fictionallist = csv_to_list("fictional characters")
|
||||
nonfictionallist = csv_to_list("nonfictional characters")
|
||||
conceptsuffixlist = csv_to_list("concept_suffix")
|
||||
buildinglist = csv_to_list("buildings")
|
||||
vehiclelist = csv_to_list("vehicles")
|
||||
outfitlist = csv_to_list("outfits")
|
||||
locationlist = csv_to_list("locations")
|
||||
|
||||
accessorielist = csv_to_list("accessories")
|
||||
artmovementlist = csv_to_list("artmovements")
|
||||
bodytypelist = csv_to_list("body_types")
|
||||
cameralist = csv_to_list("cameras")
|
||||
colorschemelist = csv_to_list("colorscheme")
|
||||
conceptprefixlist = csv_to_list("concept_prefix")
|
||||
culturelist = csv_to_list("cultures")
|
||||
descriptorlist = csv_to_list("descriptors")
|
||||
devmessagelist = csv_to_list("devmessages")
|
||||
directionlist = csv_to_list("directions")
|
||||
emojilist = csv_to_list("emojis")
|
||||
eventlist = csv_to_list("events")
|
||||
focuslist = csv_to_list("focus")
|
||||
greatworklist = csv_to_list("greatworks")
|
||||
haircolorlist = csv_to_list("haircolors")
|
||||
hairstylelist = csv_to_list("hairstyles")
|
||||
humanactivitylist = csv_to_list("human_activities")
|
||||
humanoidlist = csv_to_list("humanoids")
|
||||
imagetypelist = csv_to_list("imagetypes")
|
||||
joblist = csv_to_list("jobs")
|
||||
lenslist = csv_to_list("lenses")
|
||||
lightinglist = csv_to_list("lighting")
|
||||
malefemalelist = csv_to_list("malefemale")
|
||||
manwomanlist = csv_to_list("manwoman")
|
||||
moodlist = csv_to_list("moods")
|
||||
othertypelist = csv_to_list("othertypes")
|
||||
poselist = csv_to_list("poses")
|
||||
qualitylist = csv_to_list("quality")
|
||||
shotsizelist = csv_to_list("shotsizes")
|
||||
timeperiodlist = csv_to_list("timeperiods")
|
||||
vomitlist = csv_to_list("vomit")
|
||||
|
||||
|
||||
|
||||
# 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")
|
||||
|
||||
|
||||
|
||||
if(insanitylevel==0):
|
||||
insanitylevel = random.randint(1, 10) # 10 = add everything, 1 is add almost nothing
|
||||
insanitylevel3 = int((insanitylevel/3) + 1.20)
|
||||
@@ -58,14 +115,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridlist = ["-animal-", "-object-", "-fictional-", "-nonfictional-", "-building-", "-vehicle-"]
|
||||
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")
|
||||
|
||||
# start artist part
|
||||
|
||||
artistsplacement = "front"
|
||||
if(uncommon_dist(insanitylevel) and onlyartists == False):
|
||||
@@ -153,13 +204,15 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
if artistmode in ["enhancing"]:
|
||||
completeprompt += " ["
|
||||
|
||||
# start image type
|
||||
|
||||
if(imagetype != "all" and imagetype != "all - force multiple" and imagetype != "only other types"):
|
||||
completeprompt += " " + imagetype + ", "
|
||||
elif(imagetype == "all - force multiple" or unique_dist(insanitylevel)):
|
||||
amountofimagetypes = random.randint(2,3)
|
||||
elif(imagetype == "only other types"):
|
||||
othertype = 1
|
||||
completeprompt = add_from_csv(completeprompt, "othertypes", 1, ""," of a ")
|
||||
completeprompt += random.choice(othertypelist) + " of a "
|
||||
|
||||
if(imagetype == "all" and normal_dist(insanitylevel) and amountofimagetypes <= 1):
|
||||
amountofimagetypes = 1
|
||||
@@ -167,37 +220,39 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
for i in range(amountofimagetypes):
|
||||
# one in 6 images is a complex/other type
|
||||
if(random.randint(0,5) < 5):
|
||||
completeprompt = add_from_csv(completeprompt, "imagetypes", 1, "",",")
|
||||
completeprompt += random.choice(imagetypelist) + ", "
|
||||
else:
|
||||
othertype = 1
|
||||
completeprompt = add_from_csv(completeprompt, "othertypes", 1, ""," of a ")
|
||||
completeprompt += random.choice(othertypelist) + " of a "
|
||||
|
||||
|
||||
# start shot size
|
||||
|
||||
if(mainchooser in ["object", "animal", "humanoid", "concept"] and othertype == 0 and "portrait" not in completeprompt):
|
||||
completeprompt = add_from_csv(completeprompt, "shotsizes", 0, ""," of a ")
|
||||
completeprompt += random.choice(shotsizelist) + " of a "
|
||||
elif("portrait" in completeprompt):
|
||||
completeprompt += " ,close up of a "
|
||||
# Multiple subjects doesnt really work, need to think of other way to do multiple subjects. Maybe AND in the prompt?
|
||||
# if(subjectchooser in ["object", "animal", "humanoid"] and rare_dist(insanitylevel)):
|
||||
# completeprompt = completeprompt[:-2] # remove a from
|
||||
# completeprompt = add_from_csv(completeprompt, "amounts", 0, "","")
|
||||
|
||||
|
||||
# start subject building
|
||||
|
||||
# start with descriptive qualities
|
||||
|
||||
# Common to have 1 description, uncommon to have 2
|
||||
if(common_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
|
||||
completeprompt += random.choice(descriptorlist) + " "
|
||||
|
||||
if(uncommon_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
|
||||
completeprompt += random.choice(descriptorlist) + " "
|
||||
|
||||
if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid"] and normal_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "body_types", 0, "","")
|
||||
completeprompt += random.choice(bodytypelist) + " "
|
||||
|
||||
if(subjectchooser in ["object","animal as human,","human", "job", "fictional", "non fictional", "humanoid"] and normal_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "cultures", 0, "","")
|
||||
completeprompt += random.choice(culturelist) + " "
|
||||
|
||||
if(mainchooser == "object"):
|
||||
objecttypelist = ["objects", "buildings", "vehicles"]
|
||||
objecttypelist = [objectlist, buildinglist, vehiclelist] # first select a random list, then randomly select from the corresponding list
|
||||
|
||||
if rare_dist(insanitylevel):
|
||||
hybridorswaplist = ["hybrid", "swap"]
|
||||
@@ -205,21 +260,22 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
completeprompt += "["
|
||||
|
||||
chosenobjecttype = random.choice(objecttypelist)
|
||||
completeprompt = add_from_csv(completeprompt, chosenobjecttype, 0, "","")
|
||||
|
||||
completeprompt += random.choice(chosenobjecttype) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
if(uncommon_dist(insanitylevel)):
|
||||
completeprompt += "|" + random.choice(hybridlist) + "]"
|
||||
else:
|
||||
completeprompt += "|"
|
||||
completeprompt = add_from_csv(completeprompt, chosenobjecttype, 0, "","")
|
||||
completeprompt += random.choice(chosenobjecttype) + " "
|
||||
completeprompt += "]"
|
||||
if(hybridorswap == "swap"):
|
||||
if(uncommon_dist(insanitylevel)):
|
||||
completeprompt += ":" + random.choice(hybridlist) + ":" + str(random.randint(1,5)) + "]"
|
||||
else:
|
||||
completeprompt += ":"
|
||||
completeprompt = add_from_csv(completeprompt, chosenobjecttype, 0, "","")
|
||||
completeprompt += random.choice(chosenobjecttype) + " "
|
||||
completeprompt += ":" + str(random.randint(1,5)) + "]"
|
||||
hybridorswap = ""
|
||||
|
||||
@@ -234,7 +290,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
animaladdedsomething = 1
|
||||
completeprompt += random.choice(animaladdlist) + " -animal-"
|
||||
if(animaladdedsomething != 1):
|
||||
completeprompt = add_from_csv(completeprompt, "animals", 0, "","")
|
||||
completeprompt += random.choice(animallist) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
if(uncommon_dist(insanitylevel)):
|
||||
@@ -249,11 +305,11 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridorswap = ""
|
||||
|
||||
if(subjectchooser == "human"):
|
||||
completeprompt = add_from_csv(completeprompt, "manwoman", 0, "","")
|
||||
completeprompt += random.choice(manwomanlist) + " "
|
||||
|
||||
if(subjectchooser == "job"):
|
||||
completeprompt = add_from_csv(completeprompt, "malefemale", 0, "","")
|
||||
completeprompt = add_from_csv(completeprompt, "jobs", 0, "","")
|
||||
completeprompt += random.choice(malefemalelist) + " "
|
||||
completeprompt += random.choice(joblist) + " "
|
||||
|
||||
if(subjectchooser == "fictional"):
|
||||
if rare_dist(insanitylevel):
|
||||
@@ -261,7 +317,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridorswap = random.choice(hybridorswaplist)
|
||||
completeprompt += "["
|
||||
|
||||
completeprompt = add_from_csv(completeprompt, "fictional characters", 0, "","")
|
||||
completeprompt += random.choice(fictionallist) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
completeprompt += "|" + random.choice(hybridhumanlist) + "]"
|
||||
@@ -275,7 +331,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridorswap = random.choice(hybridorswaplist)
|
||||
completeprompt += "["
|
||||
|
||||
completeprompt = add_from_csv(completeprompt, "nonfictional characters", 0, "","")
|
||||
completeprompt += random.choice(nonfictionallist) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
completeprompt += "|" + random.choice(hybridhumanlist) + "]"
|
||||
@@ -289,7 +345,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridorswap = random.choice(hybridorswaplist)
|
||||
completeprompt += "["
|
||||
|
||||
completeprompt = add_from_csv(completeprompt, "humanoids", 0, "","")
|
||||
completeprompt += random.choice(humanoidlist) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
completeprompt += "|" + random.choice(hybridhumanlist) + "]"
|
||||
@@ -303,7 +359,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
hybridorswap = random.choice(hybridorswaplist)
|
||||
completeprompt += "["
|
||||
|
||||
completeprompt = add_from_csv(completeprompt, "locations", 0, "","")
|
||||
completeprompt += random.choice(locationlist) + " "
|
||||
|
||||
if(hybridorswap == "hybrid"):
|
||||
completeprompt += "|" + "-location-" + "]"
|
||||
@@ -315,27 +371,25 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
if(unique_dist(insanitylevel)):
|
||||
insideshot = 1
|
||||
completeprompt += " from inside of a "
|
||||
addontolocation = ["locations","buildings"]
|
||||
completeprompt = add_from_csv(completeprompt, random.choice(addontolocation), 0, "","")
|
||||
addontolocation = [locationlist,buildinglist]
|
||||
completeprompt += random.choice(random.choice(addontolocation)) + " "
|
||||
|
||||
if(normal_dist(insanitylevel) and insideshot == 0):
|
||||
completeprompt += " and "
|
||||
if(rare_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
|
||||
completeprompt += random.choice(descriptorlist) + " "
|
||||
if(rare_dist(insanitylevel)):
|
||||
completeprompt = add_from_csv(completeprompt, "cultures", 0, "","")
|
||||
completeprompt += random.choice(culturelist) + " "
|
||||
|
||||
addontolocation = ["locations","buildings", "vehicles"]
|
||||
completeprompt = add_from_csv(completeprompt, random.choice(addontolocation), 0, "","")
|
||||
addontolocation = [locationlist,buildinglist, vehiclelist]
|
||||
completeprompt += random.choice(random.choice(addontolocation)) + " "
|
||||
|
||||
|
||||
|
||||
if(subjectchooser == "event"):
|
||||
completeprompt = add_from_csv(completeprompt, "events", 0, "\"","\"")
|
||||
completeprompt += " \"" + random.choice(eventlist) + "\" "
|
||||
|
||||
if(subjectchooser == "concept"):
|
||||
completeprompt = add_from_csv(completeprompt, "concept_prefix", 0, "\" The "," of ")
|
||||
completeprompt = add_from_csv(completeprompt, "concept_suffix", 0, "","\"")
|
||||
completeprompt += " \" The " + random.choice(conceptprefixlist) + " of " + random.choice(conceptsuffixlist) + "\" "
|
||||
|
||||
# object with a face
|
||||
if(mainchooser == "object" and unique_dist(insanitylevel)):
|
||||
@@ -572,18 +626,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
completeprompt += ", "
|
||||
|
||||
|
||||
#replace any values
|
||||
colorlist = csv_to_list("colors")
|
||||
animallist = csv_to_list("animals")
|
||||
materiallist = csv_to_list("materials")
|
||||
objectlist = csv_to_list("objects")
|
||||
fictionallist = csv_to_list("fictional characters")
|
||||
nonfictionallist = csv_to_list("nonfictional characters")
|
||||
conceptsuffixlist = csv_to_list("concept_suffix")
|
||||
buildinglist = csv_to_list("buildings")
|
||||
vehiclelist = csv_to_list("vehicles")
|
||||
outfitlist = csv_to_list("outfits")
|
||||
locationlist = csv_to_list("locations")
|
||||
|
||||
|
||||
# lol, this needs a rewrite :D
|
||||
while "-color-" in completeprompt or "-material-" in completeprompt or "-animal-" in completeprompt or "-object-" in completeprompt or "-fictional-" in completeprompt or "-nonfictional-" in completeprompt or "-conceptsuffix-" in completeprompt or "-building-" in completeprompt or "-vehicle-" in completeprompt or "-outfit-" in completeprompt or "-location-" in completeprompt:
|
||||
@@ -645,7 +688,6 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
|
||||
#just for me, some fun with posting fake dev messages (ala old sim games)
|
||||
if(random.randint(1, 50)==1):
|
||||
devmessagelist = csv_to_list("devmessages")
|
||||
print("")
|
||||
print(random.choice(devmessagelist))
|
||||
print("")
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
two
|
||||
a pair of
|
||||
a couple of
|
||||
three
|
||||
Four
|
||||
Five
|
||||
a group of
|
||||
a bunch of
|
||||
a gathering of
|
||||
|
Reference in New Issue
Block a user