From 118c6c4d4a0355df3a7ee16cb97875270299868b Mon Sep 17 00:00:00 2001 From: AIrjen Date: Wed, 27 Dec 2023 10:56:33 +0100 Subject: [PATCH 01/10] Added a few 100 new styles --- build_dynamic_prompt.py | 6073 +++++++++++++++++++++------------ csvfiles/concept_prefix.csv | 3 +- csvfiles/jobs.csv | 3 + csvfiles/templates/styles.csv | 308 +- 4 files changed, 4285 insertions(+), 2102 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 17c8b8f..545cbb8 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -3,24 +3,63 @@ import re from csv_reader import * from random_functions import * +# For RF only: +# from random_prompt.csv_reader import ( +# load_config_csv, +# csv_to_list, +# artist_category_csv_to_list, +# artist_category_by_category_csv_to_list, +# ) +# from random_prompt.random_functions import ( +# common_dist, +# normal_dist, +# uncommon_dist, +# rare_dist, +# legendary_dist, +# unique_dist, +# extraordinary_dist, +# novel_dist, +# chance_roll, +#) - -#builds a prompt dynamically +# builds a prompt dynamically # insanity level controls randomness of propmt 0-10 # forcesubject van be used to force a certain type of subject -# Set artistmode to none, to exclude artists -def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all", imagetype = "all", onlyartists = False, antivalues = "", prefixprompt = "", suffixprompt ="",promptcompounderlevel ="1", seperator = "comma", givensubject="",smartsubject = True,giventypeofimage="", imagemodechance = 20, gender = "all", subtypeobject="all", subtypehumanoid="all", subtypeconcept="all", advancedprompting=True, hardturnoffemojis=False, seed=-1, overrideoutfit="", prompt_g_and_l = False): - +# Set artistmode to none, to exclude artists +def build_dynamic_prompt( + insanitylevel=5, + forcesubject="all", + artists="all", + imagetype="all", + onlyartists=False, + antivalues="", + prefixprompt="", + suffixprompt="", + promptcompounderlevel="1", + seperator="comma", + givensubject="", + smartsubject=True, + giventypeofimage="", + imagemodechance=20, + gender="all", + subtypeobject="all", + subtypehumanoid="all", + subtypeconcept="all", + advancedprompting=True, + hardturnoffemojis=False, + seed=-1, + overrideoutfit="", +): # set seed # For use in ComfyUI (might bring to Automatic1111 as well) # lets do it when its larger than 0 # Otherwise, just do nothing and it will keep on working based on an earlier set seed - if(seed > 0): + if seed > 0: random.seed(seed) # - if(advancedprompting != False and random.randint(0,max(0, insanitylevel - 2)) <= 0): + if advancedprompting != False and random.randint(0, max(0, insanitylevel - 2)) <= 0: advancedprompting == False originalartistchoice = artists @@ -28,13 +67,11 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # load the config file config = load_config_csv() - - # first build up a complete anti list. Those values are removing during list building # this uses the antivalues string AND the antilist.csv emptylist = [] - antilist = csv_to_list("antilist",emptylist , "./userfiles/",1) - + antilist = csv_to_list("antilist", emptylist, "./userfiles/", 1) + antivaluelist = antivalues.split(",") antilist += antivaluelist @@ -43,7 +80,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all antilist = [s.strip().lower() for s in antilist] # Some tricks for gender to make sure we can choose Him/Her/It etc on the right time. - if(gender=="all"): + if gender == "all": genderchoicelist = ["male", "female"] gender = random.choice(genderchoicelist) heshelist = ["it"] @@ -51,61 +88,118 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all himherlist = ["it"] # we also need to oppositegender for some fun! oppositegender = "male" - if(gender=="male"): + if gender == "male": oppositegender = "female" # build all lists here - colorlist = csv_to_list("colors",antilist) - animallist = csv_to_list("animals",antilist) - materiallist = csv_to_list("materials",antilist) - objectlist = csv_to_list("objects",antilist) - fictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=gender) - nonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=gender) - oppositefictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=oppositegender) - oppositenonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=oppositegender) - conceptsuffixlist = csv_to_list("concept_suffix",antilist) - buildinglist = csv_to_list("buildings",antilist) - vehiclelist = csv_to_list("vehicles",antilist) - outfitlist = csv_to_list("outfits",antilist) - locationlist = csv_to_list("locations",antilist) + colorlist = csv_to_list("colors", antilist) + animallist = csv_to_list("animals", antilist) + materiallist = csv_to_list("materials", antilist) + objectlist = csv_to_list("objects", antilist) + fictionallist = csv_to_list( + csvfilename="fictional characters", + antilist=antilist, + skipheader=True, + gender=gender, + ) + nonfictionallist = csv_to_list( + csvfilename="nonfictional characters", + antilist=antilist, + skipheader=True, + gender=gender, + ) + oppositefictionallist = csv_to_list( + csvfilename="fictional characters", + antilist=antilist, + skipheader=True, + gender=oppositegender, + ) + oppositenonfictionallist = csv_to_list( + csvfilename="nonfictional characters", + antilist=antilist, + skipheader=True, + gender=oppositegender, + ) + conceptsuffixlist = csv_to_list("concept_suffix", antilist) + buildinglist = csv_to_list("buildings", antilist) + vehiclelist = csv_to_list("vehicles", antilist) + outfitlist = csv_to_list("outfits", antilist) + locationlist = csv_to_list("locations", antilist) - accessorielist = csv_to_list("accessories",antilist,"./csvfiles/",0,"?",False,False,gender) - artmovementlist = csv_to_list("artmovements",antilist) - bodytypelist = csv_to_list("body_types",antilist=antilist,skipheader=True,gender=gender) - cameralist = csv_to_list("cameras",antilist) - colorschemelist = csv_to_list("colorscheme",antilist) - conceptprefixlist = csv_to_list("concept_prefix",antilist) - culturelist = csv_to_list("cultures",antilist) - descriptorlist = csv_to_list("descriptors",antilist) - devmessagelist = csv_to_list("devmessages",antilist) - directionlist = csv_to_list(csvfilename="directions",antilist=antilist,insanitylevel=insanitylevel) - emojilist = csv_to_list("emojis",antilist) - eventlist = csv_to_list("events",antilist) - focuslist = csv_to_list(csvfilename="focus",antilist=antilist, insanitylevel=insanitylevel) - greatworklist = csv_to_list("greatworks",antilist) - haircolorlist = csv_to_list("haircolors",antilist) - hairstylelist = csv_to_list("hairstyles",antilist) - hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) - humanactivitylist = csv_to_list("human_activities",antilist,"./csvfiles/",0,"?",False,False) - humanoidlist = csv_to_list("humanoids",antilist) - imagetypelist = csv_to_list(csvfilename="imagetypes",antilist=antilist, insanitylevel=insanitylevel) - joblist = csv_to_list(csvfilename="jobs",antilist=antilist,skipheader=True,gender=gender) - lenslist = csv_to_list(csvfilename="lenses",antilist=antilist, insanitylevel=insanitylevel) - lightinglist = csv_to_list(csvfilename="lighting",antilist=antilist, insanitylevel=insanitylevel) - malefemalelist = csv_to_list(csvfilename="malefemale",antilist=antilist,skipheader=True,gender=gender) - manwomanlist = csv_to_list(csvfilename="manwoman",antilist=antilist,skipheader=True,gender=gender) - moodlist = csv_to_list(csvfilename="moods",antilist=antilist, insanitylevel=insanitylevel) - othertypelist = csv_to_list("othertypes",antilist) - poselist = csv_to_list("poses",antilist) - qualitylist = csv_to_list("quality",antilist) - shotsizelist = csv_to_list(csvfilename="shotsizes",antilist=antilist, insanitylevel=insanitylevel) - timeperiodlist = csv_to_list("timeperiods",antilist) - vomitlist = csv_to_list(csvfilename="vomit",antilist=antilist, insanitylevel=insanitylevel) + accessorielist = csv_to_list( + "accessories", antilist, "./csvfiles/", 0, "?", False, False, gender + ) + artmovementlist = csv_to_list("artmovements", antilist) + bodytypelist = csv_to_list( + "body_types", antilist=antilist, skipheader=True, gender=gender + ) + cameralist = csv_to_list("cameras", antilist) + colorschemelist = csv_to_list("colorscheme", antilist) + conceptprefixlist = csv_to_list("concept_prefix", antilist) + culturelist = csv_to_list("cultures", antilist) + descriptorlist = csv_to_list("descriptors", antilist) + devmessagelist = csv_to_list("devmessages", antilist) + directionlist = csv_to_list( + csvfilename="directions", antilist=antilist, insanitylevel=insanitylevel + ) + emojilist = csv_to_list("emojis", antilist) + eventlist = csv_to_list("events", antilist) + focuslist = csv_to_list( + csvfilename="focus", antilist=antilist, insanitylevel=insanitylevel + ) + greatworklist = csv_to_list("greatworks", antilist) + haircolorlist = csv_to_list("haircolors", antilist) + hairstylelist = csv_to_list("hairstyles", antilist) + hairvomitlist = csv_to_list( + "hairvomit", antilist, "./csvfiles/", 0, "?", False, False + ) + humanactivitylist = csv_to_list( + "human_activities", antilist, "./csvfiles/", 0, "?", False, False + ) + humanoidlist = csv_to_list("humanoids", antilist) + imagetypelist = csv_to_list( + csvfilename="imagetypes", antilist=antilist, insanitylevel=insanitylevel + ) + joblist = csv_to_list( + csvfilename="jobs", antilist=antilist, skipheader=True, gender=gender + ) + lenslist = csv_to_list( + csvfilename="lenses", antilist=antilist, insanitylevel=insanitylevel + ) + lightinglist = csv_to_list( + csvfilename="lighting", antilist=antilist, insanitylevel=insanitylevel + ) + malefemalelist = csv_to_list( + csvfilename="malefemale", antilist=antilist, skipheader=True, gender=gender + ) + manwomanlist = csv_to_list( + csvfilename="manwoman", antilist=antilist, skipheader=True, gender=gender + ) + moodlist = csv_to_list( + csvfilename="moods", antilist=antilist, insanitylevel=insanitylevel + ) + othertypelist = csv_to_list("othertypes", antilist) + poselist = csv_to_list("poses", antilist) + qualitylist = csv_to_list("quality", antilist) + shotsizelist = csv_to_list( + csvfilename="shotsizes", antilist=antilist, insanitylevel=insanitylevel + ) + timeperiodlist = csv_to_list("timeperiods", antilist) + vomitlist = csv_to_list( + csvfilename="vomit", antilist=antilist, insanitylevel=insanitylevel + ) foodlist = csv_to_list("foods", antilist) - genderdescriptionlist = csv_to_list(csvfilename="genderdescription",antilist=antilist,skipheader=True,gender=gender) + genderdescriptionlist = csv_to_list( + csvfilename="genderdescription", + antilist=antilist, + skipheader=True, + gender=gender, + ) minilocationlist = csv_to_list("minilocations", antilist) - minioutfitlist = csv_to_list("minioutfits",antilist,"./csvfiles/",0,"?",False,False,gender) + minioutfitlist = csv_to_list( + "minioutfits", antilist, "./csvfiles/", 0, "?", False, False, gender + ) seasonlist = csv_to_list("seasons", antilist) elaborateoutfitlist = csv_to_list("elaborateoutfits", antilist) minivomitlist = csv_to_list("minivomit", antilist) @@ -116,11 +210,24 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all poemlinelist = csv_to_list("poemlines", antilist) songlinelist = csv_to_list("songlines", antilist) musicgenrelist = csv_to_list("musicgenres", antilist) - manwomanrelationlist = csv_to_list(csvfilename="manwomanrelations",antilist=antilist,skipheader=True,gender=gender) - manwomanmultiplelist = csv_to_list(csvfilename="manwomanmultiples",antilist=antilist,skipheader=True,gender=gender,delimiter="?") + manwomanrelationlist = csv_to_list( + csvfilename="manwomanrelations", + antilist=antilist, + skipheader=True, + gender=gender, + ) + manwomanmultiplelist = csv_to_list( + csvfilename="manwomanmultiples", + antilist=antilist, + skipheader=True, + gender=gender, + delimiter="?", + ) waterlocationlist = csv_to_list("waterlocations", antilist) containerlist = csv_to_list("containers", antilist) - firstnamelist = csv_to_list(csvfilename="firstnames",antilist=antilist,skipheader=True,gender=gender) + firstnamelist = csv_to_list( + csvfilename="firstnames", antilist=antilist, skipheader=True, gender=gender + ) floralist = csv_to_list("flora", antilist) printlist = csv_to_list("prints", antilist) patternlist = csv_to_list("patterns", antilist) @@ -128,8 +235,12 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all cardnamelist = csv_to_list("card_names", antilist) coveringlist = csv_to_list("coverings", antilist) facepartlist = csv_to_list("faceparts", antilist) - outfitvomitlist = csv_to_list(csvfilename="outfitvomit",antilist=antilist,delimiter="?") - humanexpressionlist = csv_to_list(csvfilename="humanexpressions",antilist=antilist,delimiter="?") + outfitvomitlist = csv_to_list( + csvfilename="outfitvomit", antilist=antilist, delimiter="?" + ) + humanexpressionlist = csv_to_list( + csvfilename="humanexpressions", antilist=antilist, delimiter="?" + ) humanvomitlist = csv_to_list("humanvomit", antilist) eyecolorlist = csv_to_list("eyecolors", antilist) fashiondesignerlist = csv_to_list("fashiondesigners", antilist) @@ -141,19 +252,28 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all settinglist = csv_to_list("settings", antilist) charactertypelist = csv_to_list("charactertypes", antilist) objectstoholdlist = csv_to_list("objectstohold", antilist) - episodetitlelist = csv_to_list(csvfilename="episodetitles",antilist=antilist,skipheader=True) - + episodetitlelist = csv_to_list( + csvfilename="episodetitles", antilist=antilist, skipheader=True + ) # additional descriptor lists - outfitdescriptorlist = csv_to_list("outfitdescriptors",antilist) - hairdescriptorlist = csv_to_list("hairdescriptors",antilist) - humandescriptorlist = csv_to_list("humandescriptors",antilist) - locationdescriptorlist = csv_to_list("locationdescriptors",antilist) - basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors",antilist) - animaldescriptorlist = csv_to_list("animaldescriptors",antilist) + outfitdescriptorlist = csv_to_list("outfitdescriptors", antilist) + hairdescriptorlist = csv_to_list("hairdescriptors", antilist) + humandescriptorlist = csv_to_list("humandescriptors", antilist) + locationdescriptorlist = csv_to_list("locationdescriptors", antilist) + basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors", antilist) + animaldescriptorlist = csv_to_list("animaldescriptors", antilist) # descriptorlist becomes one with everything - descriptortotallist = descriptorlist + outfitdescriptorlist + hairdescriptorlist + humandescriptorlist + locationdescriptorlist + basicbitchdescriptorlist + animaldescriptorlist + descriptortotallist = ( + descriptorlist + + outfitdescriptorlist + + hairdescriptorlist + + humandescriptorlist + + locationdescriptorlist + + basicbitchdescriptorlist + + animaldescriptorlist + ) # Deduplicate the list while preserving casings descriptorlist = [] seen_items = set() @@ -161,126 +281,267 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all for item in descriptortotallist: # Convert the item to lowercase to ignore casing item_lower = item.lower() - + if item_lower not in seen_items: seen_items.add(item_lower) descriptorlist.append(item) humanlist = fictionallist + nonfictionallist + humanoidlist - objecttotallist = objectlist + buildinglist + vehiclelist + foodlist + spacelist + floralist + containerlist - outfitprinttotallist = objecttotallist + locationlist + colorlist + musicgenrelist + seasonlist + animallist + patternlist + objecttotallist = ( + objectlist + + buildinglist + + vehiclelist + + foodlist + + spacelist + + floralist + + containerlist + ) + outfitprinttotallist = ( + objecttotallist + + locationlist + + colorlist + + musicgenrelist + + seasonlist + + animallist + + patternlist + ) - humanactivitycheatinglist = ["OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)"] + humanactivitycheatinglist = [ + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + ] humanactivitylist = humanactivitylist + humanactivitycheatinglist # build artists list + if artists == "wild": + artists = "all (wild)" # we want to create more cohorence, so we are adding all (wild) mode for the old logic - + # all else will be more constrained per type, to produce better images. # the popular artists will be used more the lower the insanitylevel is # Future: add in personal artists lists as well - - # lets maybe go wild "sometimes", based on insanitylevel - if(artists == "all" and rare_dist(insanitylevel)): - artists = "all (wild)" - originalartistchoice = artists - artisttypes = ["popular", "3D", "abstract", "angular", "anime" ,"architecture", "art nouveau", "art deco", "baroque", "bauhaus", "cartoon", "character", "children's illustration", "cityscape", "cinema", "clean", "cloudscape", "collage", "colorful", "comics", "cubism", "dark", "detailed", "digital", "expressionism", "fantasy", "fashion", "fauvism", "figurativism", "graffiti", "graphic design", "high contrast", "horror", "impressionism", "installation", "landscape", "light", "line drawing", "low contrast", "luminism", "magical realism", "manga", "melanin", "messy", "monochromatic", "nature", "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"] + # lets maybe go wild "sometimes", based on insanitylevel + if artists == "all" and rare_dist(insanitylevel): + artists = "all (wild)" + originalartistchoice = artists + + artisttypes = [ + "popular", + "3D", + "abstract", + "angular", + "anime", + "architecture", + "art nouveau", + "art deco", + "baroque", + "bauhaus", + "cartoon", + "character", + "children's illustration", + "cityscape", + "cinema", + "clean", + "cloudscape", + "collage", + "colorful", + "comics", + "cubism", + "dark", + "detailed", + "digital", + "expressionism", + "fantasy", + "fashion", + "fauvism", + "figurativism", + "graffiti", + "graphic design", + "high contrast", + "horror", + "impressionism", + "installation", + "landscape", + "light", + "line drawing", + "low contrast", + "luminism", + "magical realism", + "manga", + "melanin", + "messy", + "monochromatic", + "nature", + "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", + ] artiststyleselector = "" artiststyleselectormode = "normal" - if(artists == "all" and normal_dist(insanitylevel + 1)): + + if artists == "all" and normal_dist(insanitylevel + 1): artiststyleselector = random.choice(artisttypes) artists = artiststyleselector - elif(artists == "all"): + elif artists == "all": artiststyleselectormode = "custom" - # then else maybe do nothing?? - if(random.randint(0,6) == 0 and onlyartists == False): + # then else maybe do nothing?? + if random.randint(0, 6) == 0 and onlyartists == False: generateartist = False # go popular! Or even worse, we go full greg mode! - elif(common_dist(max(3,insanitylevel))): - artists = "popular" + elif common_dist(max(3, insanitylevel)): + artists = "popular" # only on lower instanity levels anyway - elif(insanitylevel < 6): + elif insanitylevel < 6: artists = "greg mode" else: artists = "popular" - else: artiststyleselectormode = "custom" - - artistlist = [] # create artist list to use in the code, maybe based on category or personal lists - if(artists != "all (wild)" and artists != "all" and artists != "none" and artists.startswith("personal_artists") == False and artists.startswith("personal artists") == False): - artistlist = artist_category_csv_to_list("artists_and_category",artists) - elif(artists.startswith("personal_artists") == True or artists.startswith("personal artists") == True): - artists = artists.replace(" ","_",-1) # add underscores back in - artistlist = csv_to_list(artists,antilist,"./userfiles/") - elif(artists != "none"): - artistlist = csv_to_list("artists",antilist) + if ( + artists != "all (wild)" + and artists != "all" + and artists != "none" + and artists.startswith("personal_artists") == False + and artists.startswith("personal artists") == False + and artists in artisttypes + ): + artistlist = artist_category_csv_to_list("artists_and_category", artists) + elif ( + artists.startswith("personal_artists") == True + or artists.startswith("personal artists") == True + ): + artists = artists.replace(" ", "_", -1) # add underscores back in + artistlist = csv_to_list(artists, antilist, "./userfiles/") + elif artists != "none": + artistlist = csv_to_list("artists", antilist) # create special artists lists, used in templates - fantasyartistlist = artist_category_csv_to_list("artists_and_category","fantasy") - popularartistlist = artist_category_csv_to_list("artists_and_category","popular") - romanticismartistlist = artist_category_csv_to_list("artists_and_category","romanticism") - photographyartistlist = artist_category_csv_to_list("artists_and_category","photography") - portraitartistlist = artist_category_csv_to_list("artists_and_category","portrait") - characterartistlist = artist_category_csv_to_list("artists_and_category","character") - landscapeartistlist = artist_category_csv_to_list("artists_and_category","landscape") - scifiartistlist = artist_category_csv_to_list("artists_and_category","sci-fi") - graphicdesignartistlist = artist_category_csv_to_list("artists_and_category","graphic design") - digitalartistlist = artist_category_csv_to_list("artists_and_category","digital") - architectartistlist = artist_category_csv_to_list("artists_and_category","architecture") - cinemaartistlist = artist_category_csv_to_list("artists_and_category","cinema") + fantasyartistlist = artist_category_csv_to_list("artists_and_category", "fantasy") + popularartistlist = artist_category_csv_to_list("artists_and_category", "popular") + romanticismartistlist = artist_category_csv_to_list( + "artists_and_category", "romanticism" + ) + photographyartistlist = artist_category_csv_to_list( + "artists_and_category", "photography" + ) + portraitartistlist = artist_category_csv_to_list("artists_and_category", "portrait") + characterartistlist = artist_category_csv_to_list( + "artists_and_category", "character" + ) + landscapeartistlist = artist_category_csv_to_list( + "artists_and_category", "landscape" + ) + scifiartistlist = artist_category_csv_to_list("artists_and_category", "sci-fi") + graphicdesignartistlist = artist_category_csv_to_list( + "artists_and_category", "graphic design" + ) + digitalartistlist = artist_category_csv_to_list("artists_and_category", "digital") + architectartistlist = artist_category_csv_to_list( + "artists_and_category", "architecture" + ) + cinemaartistlist = artist_category_csv_to_list("artists_and_category", "cinema") gregmodelist = csv_to_list("gregmode", antilist) - # add any other custom lists - stylestiloralist = csv_to_list("styles_ti_lora",antilist,"./userfiles/") - generatestyle = bool(stylestiloralist) # True of not empty + stylestiloralist = csv_to_list("styles_ti_lora", antilist, "./userfiles/") + generatestyle = bool(stylestiloralist) # True of not empty - custominputprefixlist = csv_to_list("custom_input_prefix",antilist,"./userfiles/") - generatecustominputprefix = bool(custominputprefixlist) # True of not empty + custominputprefixlist = csv_to_list("custom_input_prefix", antilist, "./userfiles/") + generatecustominputprefix = bool(custominputprefixlist) # True of not empty - custominputmidlist = csv_to_list("custom_input_mid",antilist,"./userfiles/") - generatecustominputmid = bool(custominputmidlist) # True of not empty + custominputmidlist = csv_to_list("custom_input_mid", antilist, "./userfiles/") + generatecustominputmid = bool(custominputmidlist) # True of not empty - custominputsuffixlist = csv_to_list("custom_input_suffix",antilist,"./userfiles/") - generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty + custominputsuffixlist = csv_to_list("custom_input_suffix", antilist, "./userfiles/") + generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty - customsubjectslist = csv_to_list("custom_subjects",antilist,"./userfiles/") - customoutfitslist = csv_to_list("custom_outfits",antilist,"./userfiles/") + customsubjectslist = csv_to_list("custom_subjects", antilist, "./userfiles/") + customoutfitslist = csv_to_list("custom_outfits", antilist, "./userfiles/") # special lists - backgroundtypelist = csv_to_list("backgroundtypes", antilist,"./csvfiles/special_lists/",0,"?") - insideshotlist = csv_to_list("insideshots", antilist,"./csvfiles/special_lists/",0,"?") - photoadditionlist = csv_to_list("photoadditions", antilist,"./csvfiles/special_lists/",0,"?") - buildhairlist = csv_to_list("buildhair", antilist,"./csvfiles/special_lists/",0,"?") - buildoutfitlist = csv_to_list("buildoutfit", antilist,"./csvfiles/special_lists/",0,"?") - objectadditionslist = csv_to_list("objectadditions", antilist,"./csvfiles/special_lists/",0,"?") - humanadditionlist = csv_to_list("humanadditions", antilist,"./csvfiles/special_lists/",0,"?") - animaladditionlist = csv_to_list("animaladditions", antilist,"./csvfiles/special_lists/",0,"?") - buildaccessorielist = csv_to_list("buildaccessorie", antilist,"./csvfiles/special_lists/",0,"?") - minilocationadditionslist = csv_to_list("minilocationadditions", antilist,"./csvfiles/special_lists/",0,"?") - overalladditionlist = csv_to_list("overalladditions", antilist,"./csvfiles/special_lists/",0,"?") - imagetypemodelist = csv_to_list("imagetypemodes", antilist,"./csvfiles/special_lists/",0,"?") - miniactivitylist = csv_to_list("miniactivity", antilist,"./csvfiles/special_lists/",0,"?") - animalsuffixadditionlist = csv_to_list("animalsuffixadditions", antilist,"./csvfiles/special_lists/",0,"?") - buildfacepartlist = csv_to_list("buildfaceparts", antilist,"./csvfiles/special_lists/",0,"?") - buildfacelist = csv_to_list("buildface", antilist,"./csvfiles/special_lists/",0,"?") - - styleslist = csv_to_list("styles", antilist,"./csvfiles/templates/",0,"?") + backgroundtypelist = csv_to_list( + "backgroundtypes", antilist, "./csvfiles/special_lists/", 0, "?" + ) + insideshotlist = csv_to_list( + "insideshots", antilist, "./csvfiles/special_lists/", 0, "?" + ) + photoadditionlist = csv_to_list( + "photoadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildhairlist = csv_to_list( + "buildhair", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildoutfitlist = csv_to_list( + "buildoutfit", antilist, "./csvfiles/special_lists/", 0, "?" + ) + objectadditionslist = csv_to_list( + "objectadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + humanadditionlist = csv_to_list( + "humanadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + animaladditionlist = csv_to_list( + "animaladditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildaccessorielist = csv_to_list( + "buildaccessorie", antilist, "./csvfiles/special_lists/", 0, "?" + ) + minilocationadditionslist = csv_to_list( + "minilocationadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + overalladditionlist = csv_to_list( + "overalladditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + imagetypemodelist = csv_to_list( + "imagetypemodes", antilist, "./csvfiles/special_lists/", 0, "?" + ) + miniactivitylist = csv_to_list( + "miniactivity", antilist, "./csvfiles/special_lists/", 0, "?" + ) + animalsuffixadditionlist = csv_to_list( + "animalsuffixadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildfacepartlist = csv_to_list( + "buildfaceparts", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildfacelist = csv_to_list( + "buildface", antilist, "./csvfiles/special_lists/", 0, "?" + ) + styleslist = csv_to_list("styles", antilist, "./csvfiles/templates/", 0, "?") - # subjects mainchooserlist = [] objectwildcardlist = [] @@ -316,412 +577,432 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all generateepisodetitle = True custominputprefixrepeats = 2 - custominputprefixchance = 'uncommon' + custominputprefixchance = "uncommon" - imagetypechance = 'normal' + imagetypechance = "normal" generateimagetype = True - imagetypequalitychance = 'rare' + imagetypequalitychance = "rare" generateimagetypequality = True generateminilocationaddition = True - minilocationadditionchance = 'unique' - artmovementprefixchance = 'unique' - minivomitprefix1chance = 'rare' - minivomitprefix2chance = 'unique' - shotsizechance = 'uncommon' + minilocationadditionchance = "unique" + artmovementprefixchance = "unique" + minivomitprefix1chance = "rare" + minivomitprefix2chance = "unique" + shotsizechance = "uncommon" - subjectdescriptor1chance = 'common' - subjectdescriptor2chance = 'uncommon' - subjectbodytypechance = 'normal' - subjectculturechance = 'normal' - subjectconceptsuffixchance = 'unique' + subjectdescriptor1chance = "common" + subjectdescriptor2chance = "uncommon" + subjectbodytypechance = "normal" + subjectculturechance = "normal" + subjectconceptsuffixchance = "unique" - subjectlandscapeinsideshotchance = 'unique' - subjectlandscapeaddonlocationchance = 'normal' - subjectlandscapeaddonlocationdescriptorchance = 'rare' - subjectlandscapeaddonlocationculturechance = 'rare' + subjectlandscapeinsideshotchance = "unique" + subjectlandscapeaddonlocationchance = "normal" + subjectlandscapeaddonlocationdescriptorchance = "rare" + subjectlandscapeaddonlocationculturechance = "rare" objectadditionsrepeats = 2 - objectadditionschance = 'uncommon' - humanadditionchance = 'rare' - overalladditionchance = 'extraordinary' + objectadditionschance = "uncommon" + humanadditionchance = "rare" + overalladditionchance = "extraordinary" - emojichance = 'legendary' - buildfacechance = 'legendary' - humanexpressionchance = 'rare' - joboractivitychance = 'normal' - humanvomitchance = 'rare' + emojichance = "legendary" + buildfacechance = "legendary" + humanexpressionchance = "rare" + joboractivitychance = "normal" + humanvomitchance = "rare" custominputmidrepeats = 2 - custominputmidchance = 'uncommon' - minivomitmidchance = 'unique' + custominputmidchance = "uncommon" + minivomitmidchance = "unique" - outfitchance = 'normal' - posechance = 'uncommon' - hairchance = 'normal' - accessorychance = 'normal' - humanoidinsideshotchance = 'legendary' - humanoidbackgroundchance = 'uncommon' + outfitchance = "normal" + posechance = "uncommon" + hairchance = "normal" + accessorychance = "normal" + humanoidinsideshotchance = "legendary" + humanoidbackgroundchance = "uncommon" - landscapeminilocationchance = 'uncommon' - generalminilocationchance = 'rare' + landscapeminilocationchance = "uncommon" + generalminilocationchance = "rare" - timperiodchance = 'normal' - focuschance = 'normal' - directionchance = 'normal' - moodchance = 'normal' - minivomitsuffixchance = 'unique' - artmovementchance = 'normal' - lightingchance = 'normal' - photoadditionchance = 'common' - lenschance = 'normal' - colorschemechance = 'normal' - vomit1chance = 'uncommon' - vomit2chance= 'uncommon' - greatworkchance = 'novel' - poemlinechance = 'novel' - songlinechance = 'novel' - quality1chance = 'uncommon' - quality2chance = 'uncommon' + timperiodchance = "normal" + focuschance = "normal" + directionchance = "normal" + moodchance = "normal" + minivomitsuffixchance = "unique" + artmovementchance = "normal" + lightingchance = "normal" + photoadditionchance = "common" + lenschance = "normal" + colorschemechance = "normal" + vomit1chance = "uncommon" + vomit2chance = "uncommon" + greatworkchance = "novel" + poemlinechance = "novel" + songlinechance = "novel" + quality1chance = "uncommon" + quality2chance = "uncommon" - customstyle1chance = 'uncommon' - customstyle2chance = 'uncommon' + customstyle1chance = "uncommon" + customstyle2chance = "uncommon" custominputsuffixrepeats = 2 - custominputsuffixchance = 'uncommon' + custominputsuffixchance = "uncommon" - artistsatbackchance = 'uncommon' + artistsatbackchance = "uncommon" for item in config: # objects - if item[0] == 'subject_vehicle' and item[1] != 'on': + if item[0] == "subject_vehicle" and item[1] != "on": generatevehicle = False - if item[0] == 'subject_object' and item[1] != 'on': + if item[0] == "subject_object" and item[1] != "on": generateobject = False - if item[0] == 'subject_food' and item[1] != 'on': + if item[0] == "subject_food" and item[1] != "on": generatefood = False - if item[0] == 'subject_building' and item[1] != 'on': + if item[0] == "subject_building" and item[1] != "on": generatebuilding = False - if item[0] == 'subject_space' and item[1] != 'on': + if item[0] == "subject_space" and item[1] != "on": generatespace = False - if item[0] == 'subject_flora' and item[1] != 'on': + if item[0] == "subject_flora" and item[1] != "on": generateflora = False # animals - if item[0] == 'subject_animal' and item[1] != 'on': + if item[0] == "subject_animal" and item[1] != "on": generateanimal = False # humanoids - if item[0] == 'subject_manwoman' and item[1] != 'on': + if item[0] == "subject_manwoman" and item[1] != "on": generatemanwoman = False - if item[0] == 'subject_manwomanrelation' and item[1] != 'on': + if item[0] == "subject_manwomanrelation" and item[1] != "on": generatemanwomanrelation = False - if item[0] == 'subject_manwomanmultiple' and item[1] != 'on': + if item[0] == "subject_manwomanmultiple" and item[1] != "on": generatemanwomanmultiple = False - if item[0] == 'subject_fictional' and item[1] != 'on': + if item[0] == "subject_fictional" and item[1] != "on": generatefictionalcharacter = False - if item[0] == 'subject_nonfictional' and item[1] != 'on': + if item[0] == "subject_nonfictional" and item[1] != "on": generatenonfictionalcharacter = False - if item[0] == 'subject_humanoid' and item[1] != 'on': + if item[0] == "subject_humanoid" and item[1] != "on": generatehumanoids = False - if item[0] == 'subject_job' and item[1] != 'on': + if item[0] == "subject_job" and item[1] != "on": generatejob = False - if item[0] == 'subject_firstnames' and item[1] != 'on': + if item[0] == "subject_firstnames" and item[1] != "on": generatefirstnames = False # landscape - if item[0] == 'subject_landscape' and item[1] != 'on': + if item[0] == "subject_landscape" and item[1] != "on": generatelandscape = False # concept - if item[0] == 'subject_event' and item[1] != 'on': + if item[0] == "subject_event" and item[1] != "on": generateevent = False - if item[0] == 'subject_concept' and item[1] != 'on': + if item[0] == "subject_concept" and item[1] != "on": generateconcepts = False - if item[0] == 'subject_poemline' and item[1] != 'on': + if item[0] == "subject_poemline" and item[1] != "on": generatepoemline = False - if item[0] == 'subject_songline' and item[1] != 'on': + if item[0] == "subject_songline" and item[1] != "on": generatesongline = False - if item[0] == 'subject_cardname' and item[1] != 'on': + if item[0] == "subject_cardname" and item[1] != "on": generatecardname = False - if item[0] == 'subject_episodetitle' and item[1] != 'on': + if item[0] == "subject_episodetitle" and item[1] != "on": generateepisodetitle = False - + # main list stuff - if item[0] == 'custominputprefixrepeats': + if item[0] == "custominputprefixrepeats": custominputprefixrepeats = int(item[1]) - if item[0] == 'custominputprefixchance': + if item[0] == "custominputprefixchance": custominputprefixchance = item[1] - if(custominputprefixchance == 'never'): + if custominputprefixchance == "never": generatecustominputprefix = False - if item[0] == 'imagetypechance': + if item[0] == "imagetypechance": imagetypechance = item[1] - if(imagetypechance == 'never'): + if imagetypechance == "never": generateimagetype = False - if item[0] == 'imagetypequalitychance': + if item[0] == "imagetypequalitychance": imagetypequalitychance = item[1] - if(imagetypequalitychance == 'never'): + if imagetypequalitychance == "never": generateimagetypequality = False - if item[0] == 'minilocationadditionchance': + if item[0] == "minilocationadditionchance": minilocationadditionchance = item[1] - if item[0] == 'artmovementprefixchance': + if item[0] == "artmovementprefixchance": artmovementprefixchance = item[1] - if item[0] == 'minivomitprefix1chance': + if item[0] == "minivomitprefix1chance": minivomitprefix1chance = item[1] - if item[0] == 'minivomitprefix2chance': + if item[0] == "minivomitprefix2chance": minivomitprefix2chance = item[1] - - if item[0] == 'shotsizechance': + + if item[0] == "shotsizechance": shotsizechance = item[1] - if item[0] == 'subjectdescriptor1chance': + if item[0] == "subjectdescriptor1chance": subjectdescriptor1chance = item[1] - if item[0] == 'subjectdescriptor2chance': + if item[0] == "subjectdescriptor2chance": subjectdescriptor2chance = item[1] - if item[0] == 'subjectbodytypechance': + if item[0] == "subjectbodytypechance": subjectbodytypechance = item[1] - if item[0] == 'subjectculturechance': + if item[0] == "subjectculturechance": subjectculturechance = item[1] - if item[0] == 'subjectconceptsuffixchance': + if item[0] == "subjectconceptsuffixchance": subjectconceptsuffixchance = item[1] - if item[0] == 'subjectlandscapeinsideshotchance': + if item[0] == "subjectlandscapeinsideshotchance": subjectlandscapeinsideshotchance = item[1] - if item[0] == 'subjectlandscapeaddonlocationchance': + if item[0] == "subjectlandscapeaddonlocationchance": subjectlandscapeaddonlocationchance = item[1] - if item[0] == 'subjectlandscapeaddonlocationdescriptorchance': + if item[0] == "subjectlandscapeaddonlocationdescriptorchance": subjectlandscapeaddonlocationdescriptorchance = item[1] - if item[0] == 'subjectlandscapeaddonlocationculturechance': + if item[0] == "subjectlandscapeaddonlocationculturechance": subjectlandscapeaddonlocationculturechance = item[1] - if item[0] == 'objectadditionsrepeats': + if item[0] == "objectadditionsrepeats": objectadditionsrepeats = int(item[1]) - if item[0] == 'objectadditionschance': + if item[0] == "objectadditionschance": objectadditionschance = item[1] - if item[0] == 'humanadditionchance': + if item[0] == "humanadditionchance": humanadditionchance = item[1] - if item[0] == 'overalladditionchance': + if item[0] == "overalladditionchance": overalladditionchance = item[1] - if item[0] == 'emojichance': + if item[0] == "emojichance": emojichance = item[1] - if(hardturnoffemojis==True): - emojichance='never' - if item[0] == 'buildfacechance': + if hardturnoffemojis == True: + emojichance = "never" + if item[0] == "buildfacechance": buildfacechance = item[1] - if item[0] == 'humanexpressionchance': + if item[0] == "humanexpressionchance": humanexpressionchance = item[1] - if item[0] == 'humanvomitchance': + if item[0] == "humanvomitchance": humanvomitchance = item[1] - if item[0] == 'joboractivitychance': + if item[0] == "joboractivitychance": joboractivitychance = item[1] - if item[0] == 'custominputmidrepeats': + if item[0] == "custominputmidrepeats": custominputmidrepeats = int(item[1]) - if item[0] == 'custominputmidchance': + if item[0] == "custominputmidchance": custominputmidchance = item[1] - if item[0] == 'minivomitmidchance': + if item[0] == "minivomitmidchance": minivomitmidchance = item[1] - - if item[0] == 'outfitchance': + + if item[0] == "outfitchance": outfitchance = item[1] - if item[0] == 'posechance': + if item[0] == "posechance": posechance = item[1] - if item[0] == 'hairchance': + if item[0] == "hairchance": hairchance = item[1] - if item[0] == 'accessorychance': + if item[0] == "accessorychance": accessorychance = item[1] - if item[0] == 'humanoidinsideshotchance': + if item[0] == "humanoidinsideshotchance": humanoidinsideshotchance = item[1] - if item[0] == 'humanoidbackgroundchance': + if item[0] == "humanoidbackgroundchance": humanoidbackgroundchance = item[1] - if item[0] == 'landscapeminilocationchance': + if item[0] == "landscapeminilocationchance": landscapeminilocationchance = item[1] - if item[0] == 'generalminilocationchance': + if item[0] == "generalminilocationchance": generalminilocationchance = item[1] - if item[0] == 'timperiodchance': + if item[0] == "timperiodchance": timperiodchance = item[1] - if item[0] == 'focuschance': + if item[0] == "focuschance": focuschance = item[1] - if item[0] == 'directionchance': + if item[0] == "directionchance": directionchance = item[1] - if item[0] == 'moodchance': + if item[0] == "moodchance": moodchance = item[1] - if item[0] == 'minivomitsuffixchance': + if item[0] == "minivomitsuffixchance": minivomitsuffixchance = item[1] - if item[0] == 'artmovementchance': + if item[0] == "artmovementchance": artmovementchance = item[1] - if item[0] == 'lightingchance': + if item[0] == "lightingchance": lightingchance = item[1] - if item[0] == 'photoadditionchance': + if item[0] == "photoadditionchance": photoadditionchance = item[1] - if item[0] == 'lenschance': + if item[0] == "lenschance": lenschance = item[1] - if item[0] == 'colorschemechance': + if item[0] == "colorschemechance": colorschemechance = item[1] - if item[0] == 'vomit1chance': + if item[0] == "vomit1chance": vomit1chance = item[1] - if item[0] == 'vomit2chance': + if item[0] == "vomit2chance": vomit2chance = item[1] - if item[0] == 'greatworkchance': + if item[0] == "greatworkchance": greatworkchance = item[1] - if item[0] == 'poemlinechance': + if item[0] == "poemlinechance": poemlinechance = item[1] - if item[0] == 'songlinechance': + if item[0] == "songlinechance": songlinechance = item[1] - if item[0] == 'quality1chance': + if item[0] == "quality1chance": quality1chance = item[1] - if item[0] == 'quality2chance': + if item[0] == "quality2chance": quality2chance = item[1] - if item[0] == 'customstyle1chance': + if item[0] == "customstyle1chance": customstyle1chance = item[1] - if item[0] == 'customstyle2chance': + if item[0] == "customstyle2chance": customstyle2chance = item[1] - - if item[0] == 'custominputsuffixrepeats': + + if item[0] == "custominputsuffixrepeats": custominputsuffixrepeats = int(item[1]) - if item[0] == 'custominputsuffixchance': + if item[0] == "custominputsuffixchance": custominputsuffixchance = item[1] - if item[0] == 'artistsatbackchance': + if item[0] == "artistsatbackchance": artistsatbackchance = item[1] - generatevehicle = bool(vehiclelist) and generatevehicle generateobject = bool(objectlist) and generateobject generatefood = bool(foodlist) and generatefood generatebuilding = bool(buildinglist) and generatebuilding generatespace = bool(spacelist) and generatespace generateflora = bool(floralist) and generateflora - generateobject = generatevehicle or generateobject or generatefood or generatebuilding or generatespace or generateflora - + generateobject = ( + generatevehicle + or generateobject + or generatefood + or generatebuilding + or generatespace + or generateflora + ) - if(generatevehicle): + if generatevehicle: objectwildcardlist.append("-vehicle-") hybridlist.append("-vehicle-") addontolocationlist.append("-vehicle-") - - if(generateobject): + + if generateobject: objectwildcardlist.append("-object-") hybridlist.append("-object-") - if(generatefood): + if generatefood: objectwildcardlist.append("-food-") hybridlist.append("-food-") - - if(generatespace): + + if generatespace: objectwildcardlist.append("-space-") hybridlist.append("-space-") addontolocationlist.append("-space-") - if(generatebuilding): + if generatebuilding: objectwildcardlist.append("-building-") hybridlist.append("-building-") addontolocationlist.append("-building-") addontolocationinsidelist.append("-building-") - - if(generateflora): + + if generateflora: objectwildcardlist.append("-flora-") hybridlist.append("-flora-") addontolocationlist.append("-flora-") - - if(generateobject): + + if generateobject: mainchooserlist.append("object") generatefictionalcharacter = bool(fictionallist) and generatefictionalcharacter - generatenonfictionalcharacter = bool(nonfictionallist) and generatenonfictionalcharacter + generatenonfictionalcharacter = ( + bool(nonfictionallist) and generatenonfictionalcharacter + ) generatehumanoids = bool(humanoidlist) and generatehumanoids generatemanwoman = bool(manwomanlist) and generatemanwoman generatemanwomanrelation = bool(manwomanrelationlist) and generatemanwomanrelation generatemanwomanmultiple = bool(manwomanmultiplelist) and generatemanwomanmultiple generatejob = bool(joblist) and generatejob generatefirstnames = bool(firstnamelist) and generatefirstnames - generatehumanoid = generatefictionalcharacter or generatenonfictionalcharacter or generatehumanoids or generatemanwoman or generatejob or generatemanwomanrelation or generatefirstnames or generatemanwomanmultiple + generatehumanoid = ( + generatefictionalcharacter + or generatenonfictionalcharacter + or generatehumanoids + or generatemanwoman + or generatejob + or generatemanwomanrelation + or generatefirstnames + or generatemanwomanmultiple + ) - - if(generatefictionalcharacter): + if generatefictionalcharacter: humanoidsubjectchooserlist.append("fictional") hybridlist.append("-fictional-") hybridhumanlist.append("-fictional-") - if(generatefictionalcharacter): + if generatefictionalcharacter: humanoidsubjectchooserlist.append("non fictional") hybridlist.append("-nonfictional-") hybridhumanlist.append("-nonfictional-") - - if(generatehumanoids): + + if generatehumanoids: humanoidsubjectchooserlist.append("humanoid") hybridlist.append("-humanoid-") hybridhumanlist.append("-humanoid-") - - if(generatemanwoman): + + if generatemanwoman: humanoidsubjectchooserlist.append("human") - if(generatemanwomanrelation): + if generatemanwomanrelation: humanoidsubjectchooserlist.append("manwomanrelation") - - if(generatemanwomanmultiple): + + if generatemanwomanmultiple: humanoidsubjectchooserlist.append("manwomanmultiple") - if(generatejob): + if generatejob: humanoidsubjectchooserlist.append("job") - - if(generatehumanoid): + + if generatehumanoid: mainchooserlist.append("humanoid") - if(generatefirstnames): + if generatefirstnames: humanoidsubjectchooserlist.append("firstname") - - + generateanimal = bool(animallist) and generateanimal - if(generateanimal): + if generateanimal: mainchooserlist.append("animal") hybridlist.append("-animal-") generatelandscape = bool(locationlist) and generatelandscape - if(generatelandscape): + if generatelandscape: mainchooserlist.append("landscape") addontolocationlist.append("-location-") addontolocationinsidelist.append("-location-") - + generateevent = bool(eventlist) and generateevent - generateconcepts = bool(conceptprefixlist) and bool(conceptsuffixlist) and generateconcepts - generatepoemline = bool(poemlinelist) and generatepoemline + generateconcepts = ( + bool(conceptprefixlist) and bool(conceptsuffixlist) and generateconcepts + ) + generatepoemline = bool(poemlinelist) and generatepoemline generatesongline = bool(songlinelist) and generatesongline generatecardname = bool(cardnamelist) and generatecardname generateepisodetitle = bool(episodetitlelist) and generateepisodetitle - + generateconcept = ( + generateevent or generateconcepts or generatepoemline or generatesongline + ) - generateconcept = generateevent or generateconcepts or generatepoemline or generatesongline - - if(generateevent): + if generateevent: eventsubjectchooserlist.append("event") - - if(generateconcepts): + + if generateconcepts: eventsubjectchooserlist.append("concept") - if(generatepoemline): + if generatepoemline: eventsubjectchooserlist.append("poemline") - - if(generatesongline): + + if generatesongline: eventsubjectchooserlist.append("songline") - - if(generatecardname): + + if generatecardname: eventsubjectchooserlist.append("cardname") - if(generateepisodetitle): + if generateepisodetitle: eventsubjectchooserlist.append("episodetitle") - if(generateconcept): + if generateconcept: mainchooserlist.append("concept") - - # determine wether we have a special mode or not - if(random.randint(1,int(imagemodechance)) == 1 and imagetype == "all" and giventypeofimage == "" and onlyartists == False): - imagetype = random.choice(imagetypemodelist) # override imagetype with a random "mode" value - + if ( + random.randint(1, int(imagemodechance)) == 1 + and imagetype == "all" + and giventypeofimage == "" + and onlyartists == False + ): + imagetype = random.choice( + imagetypemodelist + ) # override imagetype with a random "mode" value specialmode = False templatemode = False @@ -735,53 +1016,52 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all stylesmode = False # determine wether we should go for a template or not. Not hooked up to insanitylevel - if(imagetype == "only templates mode"): + if imagetype == "only templates mode": specialmode = True templatemode = True print("Running with a randomized template instead of a randomized prompt") - if(imagetype == "art blaster mode"): + if imagetype == "art blaster mode": specialmode = True artblastermode = True print("Running in art blaster mode") - if(imagetype == "unique art mode"): + if imagetype == "unique art mode": specialmode = True uniqueartmode = True print("Running in unique art mode") - if(imagetype == "quality vomit mode"): + if imagetype == "quality vomit mode": specialmode = True qualityvomitmode = True print("Running in quality vomit mode") - if(imagetype == "color cannon mode"): + if imagetype == "color cannon mode": specialmode = True colorcannonmode = True print("Running in color cannon mode") - if(imagetype == "photo fantasy mode"): + if imagetype == "photo fantasy mode": specialmode = True photofantasymode = True print("Running in photo fantasy mode") - if(imagetype == "massive madness mode"): + if imagetype == "massive madness mode": specialmode = True massivemadnessmode = True print("Running in massive madness mode") print("Are you ready for this?") - if(imagetype == "subject only mode"): + if imagetype == "subject only mode": specialmode = True onlysubjectmode = True print("Running in only subject mode") - if(imagetype == "fixed styles mode"): + if imagetype == "fixed styles mode": specialmode = True stylesmode = True print("Running with a randomized style instead of a randomized prompt") - # main stuff generatetype = not specialmode generatesubject = not templatemode @@ -826,17 +1106,17 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all generatesongline = bool(songlinelist) and not specialmode generatecardname = bool(cardnamelist) and not specialmode generateepisodetitle = bool(episodetitlelist) and not specialmode - + generateminilocationaddition = bool(minilocationadditionslist) and not specialmode generateminivomit = bool(minivomitlist) and not specialmode - generateimagetypequality = bool(imagetypequalitylist) and not specialmode and generateimagetypequality + generateimagetypequality = ( + bool(imagetypequalitylist) and not specialmode and generateimagetypequality + ) generateoveralladdition = bool(overalladditionlist) and not specialmode generateimagetype = bool(imagetypelist) and not specialmode and generateimagetype - # Smart subject logic - if(givensubject != "" and smartsubject == True): - + if givensubject != "" and smartsubject == True: # Remove any list that has a matching word in the list # Remove any list/logic with keywords, such as: # wearing, bodytype, pose, location, hair, background @@ -844,7 +1124,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # first get all the words # Split the string by commas and spaces - words = re.split(r'[,\s]+', givensubject) + words = re.split(r"[,\s]+", givensubject) # Remove leading/trailing whitespaces from each word words = [word.strip() for word in words] @@ -855,8 +1135,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all givensubjectlistsinglewords = list(set(words)) # now get all words clumped together by commas - if ',' in givensubject: - allwords = givensubject.split(',') + if "," in givensubject: + allwords = givensubject.split(",") else: allwords = [givensubject] # Remove leading/trailing whitespaces from each word and convert to lowercase @@ -867,134 +1147,207 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all givensubjectlist = givensubjectlistsinglewords + givensubjectlistwords - # Check only for the lists that make sense? - + # outfit - foundinlist = any(word.lower() in [item.lower() for item in outfitlist] for word in givensubjectlist) - keywordslist = ["wearing","outfit", "dressed"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + foundinlist = any( + word.lower() in [item.lower() for item in outfitlist] + for word in givensubjectlist + ) + keywordslist = ["wearing", "outfit", "dressed"] + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generateoutfit = False - + # bodytype - foundinlist = any(word.lower() in [item.lower() for item in bodytypelist] for word in givensubjectlist) - keywordslist = ["bodytype","body type"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + foundinlist = any( + word.lower() in [item.lower() for item in bodytypelist] + for word in givensubjectlist + ) + keywordslist = ["bodytype", "body type"] + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatebodytype = False # hair - foundinlist = any(word.lower() in [item.lower() for item in hairstylelist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in hairstylelist] + for word in givensubjectlist + ) keywordslist = ["hair"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatehairstyle = False - + # descriptorlist - foundinlist = any(word.lower() in [item.lower() for item in descriptorlist] for word in givensubjectlist) - foundinlist2 = any(word.lower() in [item.lower() for item in culturelist] for word in givensubjectlist) - if(foundinlist == True or foundinlist2 == True): + foundinlist = any( + word.lower() in [item.lower() for item in descriptorlist] + for word in givensubjectlist + ) + foundinlist2 = any( + word.lower() in [item.lower() for item in culturelist] + for word in givensubjectlist + ) + if foundinlist == True or foundinlist2 == True: generatedescriptors = False # background - foundinlist = any(word.lower() in [item.lower() for item in locationlist] for word in givensubjectlist) - foundinlist2 = any(word.lower() in [item.lower() for item in buildinglist] for word in givensubjectlist) - keywordslist = ["location","background", "inside"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or foundinlist2 == True or keywordsinstring == True): + foundinlist = any( + word.lower() in [item.lower() for item in locationlist] + for word in givensubjectlist + ) + foundinlist2 = any( + word.lower() in [item.lower() for item in buildinglist] + for word in givensubjectlist + ) + keywordslist = ["location", "background", "inside"] + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or foundinlist2 == True or keywordsinstring == True: generatebackground = False generateinsideshot = False # accessorielist - foundinlist = any(word.lower() in [item.lower() for item in accessorielist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in accessorielist] + for word in givensubjectlist + ) + if foundinlist == True: generateaccessorie = False # lenslist - foundinlist = any(word.lower() in [item.lower() for item in lenslist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in lenslist] + for word in givensubjectlist + ) + if foundinlist == True: generatelens = False # lightinglist - foundinlist = any(word.lower() in [item.lower() for item in lightinglist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in lightinglist] + for word in givensubjectlist + ) keywordslist = ["lighting"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatelighting = False # mood - foundinlist = any(word.lower() in [item.lower() for item in moodlist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in moodlist] + for word in givensubjectlist + ) keywordslist = ["mood"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatemood = False - # poselist - foundinlist = any(word.lower() in [item.lower() for item in poselist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in poselist] + for word in givensubjectlist + ) keywordslist = ["pose", "posing"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatepose = False # qualitylist - foundinlist = any(word.lower() in [item.lower() for item in qualitylist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in qualitylist] + for word in givensubjectlist + ) keywordslist = ["quality"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generatequality = False # shotsize - foundinlist = any(word.lower() in [item.lower() for item in shotsizelist] for word in givensubjectlist) + foundinlist = any( + word.lower() in [item.lower() for item in shotsizelist] + for word in givensubjectlist + ) keywordslist = ["shot"] - keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - if(foundinlist == True or keywordsinstring == True): + keywordsinstring = any( + word.lower() in givensubject.lower() for word in keywordslist + ) + if foundinlist == True or keywordsinstring == True: generateshot = False # timeperiodlist - foundinlist = any(word.lower() in [item.lower() for item in timeperiodlist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in timeperiodlist] + for word in givensubjectlist + ) + if foundinlist == True: generatetimeperiod = False # vomit - foundinlist = any(word.lower() in [item.lower() for item in vomitlist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in vomitlist] + for word in givensubjectlist + ) + if foundinlist == True: generatevomit = False # directionlist - foundinlist = any(word.lower() in [item.lower() for item in directionlist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in directionlist] + for word in givensubjectlist + ) + if foundinlist == True: generatedirection = False # focus - foundinlist = any(word.lower() in [item.lower() for item in focuslist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in focuslist] + for word in givensubjectlist + ) + if foundinlist == True: generatefocus = False # artmovementlist - foundinlist = any(word.lower() in [item.lower() for item in artmovementlist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in artmovementlist] + for word in givensubjectlist + ) + if foundinlist == True: generateartmovement = False - + # camera - foundinlist = any(word.lower() in [item.lower() for item in cameralist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in cameralist] + for word in givensubjectlist + ) + if foundinlist == True: generatecamera = False # colorschemelist - foundinlist = any(word.lower() in [item.lower() for item in colorschemelist] for word in givensubjectlist) - if(foundinlist == True): + foundinlist = any( + word.lower() in [item.lower() for item in colorschemelist] + for word in givensubjectlist + ) + if foundinlist == True: generatecolorscheme = False - - - completeprompt = "" - - - - + promptstocompound = int(promptcompounderlevel) compoundcounter = 0 @@ -1011,15 +1364,16 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all buildingfullmode = False subjectchooser = "" mainchooser = "" - + completeprompt += prefixprompt completeprompt += ", " - if(templatemode==True): - templatelist = csv_to_list("templates", antilist,"./csvfiles/templates/",1,";",True) + if templatemode == True: + templatelist = csv_to_list( + "templates", antilist, "./csvfiles/templates/", 1, ";", True + ) - # templateenvironments = [templateenvironment[1] for templateenvironment in templatelist] # templateenvironmentsources = [templateenvironmentsource[2] for templateenvironmentsource in templatelist] # templatesubjecttypes = [templatesubjecttype[3] for templatesubjecttype in templatelist] @@ -1030,394 +1384,526 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # takes the prompt based on filters: # targettemplateenvironment: either civitai model or website # templateenvironmentsources: either - templateprompts = [templateprompt[0] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] - templatepromptcreator = [templateprompt[1] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] - templatesubjects= [templateprompt[4] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") )] - + templateprompts = [ + templateprompt[0] + for templateprompt in templatelist + if ( + ( + templateprompt[1] == targettemplateenvironment + or targettemplateenvironment == "all" + ) + and ( + templateprompt[2] == templateenvironmentsources + or templateenvironmentsources == "all" + ) + and (templateprompt[3] == forcesubject or forcesubject == "all") + ) + ] + templatepromptcreator = [ + templateprompt[1] + for templateprompt in templatelist + if ( + ( + templateprompt[1] == targettemplateenvironment + or targettemplateenvironment == "all" + ) + and ( + templateprompt[2] == templateenvironmentsources + or templateenvironmentsources == "all" + ) + and (templateprompt[3] == forcesubject or forcesubject == "all") + ) + ] + templatesubjects = [ + templateprompt[4] + for templateprompt in templatelist + if ( + ( + templateprompt[1] == targettemplateenvironment + or targettemplateenvironment == "all" + ) + and ( + templateprompt[2] == templateenvironmentsources + or templateenvironmentsources == "all" + ) + and (templateprompt[3] == forcesubject or forcesubject == "all") + ) + ] + # choose the template chosentemplate = random.choice(templateprompts) templateindex = templateprompts.index(chosentemplate) - print("Processing a prompt that was inspired from: " + templatepromptcreator[templateindex]) + print( + "Processing a prompt that was inspired from: " + + templatepromptcreator[templateindex] + ) # if there is a subject override, then replace the subject with that - if(givensubject==""): - completeprompt += chosentemplate.replace("-subject-",templatesubjects[templateindex] ) + if givensubject == "": + completeprompt += chosentemplate.replace( + "-subject-", templatesubjects[templateindex] + ) else: - completeprompt += chosentemplate.replace("-subject-",givensubject ) - + completeprompt += chosentemplate.replace("-subject-", givensubject) # custom prefix list for i in range(custominputprefixrepeats): - if(chance_roll(insanitylevel, custominputprefixchance) and generatecustominputprefix == True): + if ( + chance_roll(insanitylevel, custominputprefixchance) + and generatecustominputprefix == True + ): completeprompt += random.choice(custominputprefixlist) + ", " - - - if(insanitylevel==0): - insanitylevel = random.randint(1, 10) # 10 = add everything, 1 is add almost nothing - insanitylevel3 = int((insanitylevel/3) + 1.20) + if insanitylevel == 0: + insanitylevel = random.randint( + 1, 10 + ) # 10 = add everything, 1 is add almost nothing + insanitylevel3 = int((insanitylevel / 3) + 1.20) # print("Setting insanity level to " + str(insanitylevel)) # main chooser: 0 object, 1 animal, 2 humanoid, 3 landscape, 4 event/concept - #mainchooserlist = ["object","animal","humanoid", "landscape", "concept"] + # mainchooserlist = ["object","animal","humanoid", "landscape", "concept"] # ["popular", "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", "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"] - + # Some new logic, lets base the main chooser list on the chosen art category, to make it more cohorent # first for humanoids - artiststylelistforchecking = ["popular", "3D", "anime" "art nouveau", "art deco", "character", "fantasy", "fashion", "manga", "photography","portrait","sci-fi"] - if((artiststyleselector in artiststylelistforchecking - or artists in artiststylelistforchecking) - and (forcesubject == "all" or forcesubject == "")): - + artiststylelistforchecking = [ + "popular", + "3D", + "anime" "art nouveau", + "art deco", + "character", + "fantasy", + "fashion", + "manga", + "photography", + "portrait", + "sci-fi", + ] + if ( + artiststyleselector in artiststylelistforchecking + or artists in artiststylelistforchecking + ) and (forcesubject == "all" or forcesubject == ""): # remove the shizzle based on chance? # we want it to be MORE diverce when the insanity level raises # in this case, raise the chance for a humanoid, gets more wierd when going above 5 - if(random.randint(0,6) > max(2,insanitylevel -2) and "concept" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "concept" in mainchooserlist + ): mainchooserlist.remove("concept") - if(random.randint(0,6) > max(2,insanitylevel -2) and "landscape" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "landscape" in mainchooserlist + ): mainchooserlist.remove("landscape") - if(random.randint(0,6) > max(2,insanitylevel -2) and "object" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "object" in mainchooserlist + ): mainchooserlist.remove("object") - if(random.randint(0,6) > max(2,insanitylevel -2) and "animal" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "animal" in mainchooserlist + ): mainchooserlist.remove("animal") - + # second for landscapes # Some new logic, lets base the main chooser list on the chosen art category, to make it more cohorent - artiststylelistforchecking = ["architecture","bauhaus", "cityscape", "cinema", "cloudscape","impressionism", "installation", "landscape","magical realism", "nature", "romanticism","seascape", "space", "streetscape"] - - if((artiststyleselector in artiststylelistforchecking - or artists in artiststylelistforchecking) - and (forcesubject == "all" or forcesubject == "")): - + artiststylelistforchecking = [ + "architecture", + "bauhaus", + "cityscape", + "cinema", + "cloudscape", + "impressionism", + "installation", + "landscape", + "magical realism", + "nature", + "romanticism", + "seascape", + "space", + "streetscape", + ] + + if ( + artiststyleselector in artiststylelistforchecking + or artists in artiststylelistforchecking + ) and (forcesubject == "all" or forcesubject == ""): # remove the shizzle based on chance? # we want it to be MORE diverce when the insanity level raises # in this case, raise the chance for a landscape, gets more wierd when going above 5 - if(random.randint(0,6) > max(2,insanitylevel -2) and "concept" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "concept" in mainchooserlist + ): mainchooserlist.remove("concept") - if(random.randint(0,6) > max(2,insanitylevel -2) and "animal" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "animal" in mainchooserlist + ): mainchooserlist.remove("animal") - if(random.randint(0,6) > max(2,insanitylevel -2) and "object" in mainchooserlist): + if ( + random.randint(0, 6) > max(2, insanitylevel - 2) + and "object" in mainchooserlist + ): mainchooserlist.remove("object") - if(random.randint(0,8) > max(2,insanitylevel -2) and "humanoid" in mainchooserlist): + if ( + random.randint(0, 8) > max(2, insanitylevel - 2) + and "humanoid" in mainchooserlist + ): mainchooserlist.remove("humanoid") - # choose the main subject type mainchooser = random.choice(mainchooserlist) - - if(forcesubject != "" and forcesubject != "all"): - mainchooser = forcesubject + + if forcesubject != "" and forcesubject != "all": + mainchooser = forcesubject # 0 object, 1 animal, 2 animal as human, 3 ManWoman, 4 Job, 5 fictional, 6 non fictional, 7 humanoid, 8 landscape, 9 event - if(mainchooser == "object"): + if mainchooser == "object": subjectchooser = "object" - if(mainchooser == "animal"): + if mainchooser == "animal": # sometimes interpret the animal as a human - if(random.randint(0,5) < 5): + if random.randint(0, 5) < 5: subjectchooser = "animal" else: subjectchooser = "animal as human" - if(mainchooser == "humanoid"): - #humanoidsubjectchooserlist = ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] + if mainchooser == "humanoid": + # humanoidsubjectchooserlist = ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] # Lets put generic humans as a more 'normal' value. Manwoman relation as the least picked. # balanced around 5, to have more normal man/woman # lower values even more stable # Upper values are still quite random - humanoidsubjectchooserlistbackup = humanoidsubjectchooserlist.copy() # make a backup of the list - if(random.randint(0,9) > max(2,insanitylevel -2) and "manwomanrelation" in humanoidsubjectchooserlist): + humanoidsubjectchooserlistbackup = ( + humanoidsubjectchooserlist.copy() + ) # make a backup of the list + if ( + random.randint(0, 9) > max(2, insanitylevel - 2) + and "manwomanrelation" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("manwomanrelation") - if(random.randint(0,5) > max(2,insanitylevel -2) and "manwomanmultiple" in humanoidsubjectchooserlist): + if ( + random.randint(0, 5) > max(2, insanitylevel - 2) + and "manwomanmultiple" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("manwomanmultiple") - if(random.randint(0,7) > max(2,insanitylevel -2) and "firstname" in humanoidsubjectchooserlist): + if ( + random.randint(0, 7) > max(2, insanitylevel - 2) + and "firstname" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("firstname") - if(random.randint(0,5) > max(2,insanitylevel -2) and "job" in humanoidsubjectchooserlist): + if ( + random.randint(0, 5) > max(2, insanitylevel - 2) + and "job" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("job") - if(random.randint(0,5) > max(2,insanitylevel -2) and "fictional" in humanoidsubjectchooserlist): + if ( + random.randint(0, 5) > max(2, insanitylevel - 2) + and "fictional" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("fictional") - if(random.randint(0,5) > max(2,insanitylevel -2) and "non fictional" in humanoidsubjectchooserlist): + if ( + random.randint(0, 5) > max(2, insanitylevel - 2) + and "non fictional" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("non fictional") - if(random.randint(0,5) > max(2,insanitylevel -2) and "humanoid" in humanoidsubjectchooserlist): + if ( + random.randint(0, 5) > max(2, insanitylevel - 2) + and "humanoid" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("humanoid") # more random stuff on higher levels - if(random.randint(0,4) > max(2,insanitylevel -2) and "human" in humanoidsubjectchooserlist): + if ( + random.randint(0, 4) > max(2, insanitylevel - 2) + and "human" in humanoidsubjectchooserlist + ): humanoidsubjectchooserlist.remove("human") # if we accidently remove everything, then restore the backup list - if(not bool(humanoidsubjectchooserlist)): + if not bool(humanoidsubjectchooserlist): humanoidsubjectchooserlist = humanoidsubjectchooserlistbackup - + subjectchooser = random.choice(humanoidsubjectchooserlist) - - - - if(subtypehumanoid != "all"): - if(subtypehumanoid == "generic humans"): + + if subtypehumanoid != "all": + if subtypehumanoid == "generic humans": subjectchooser = "human" - if(subtypehumanoid == "generic human relations"): + if subtypehumanoid == "generic human relations": subjectchooser = "manwomanrelation" - if(subtypehumanoid == "multiple humans"): + if subtypehumanoid == "multiple humans": subjectchooser = "manwomanmultiple" - if(subtypehumanoid == "celebrities e.a."): + if subtypehumanoid == "celebrities e.a.": subjectchooser = "non fictional" - if(subtypehumanoid == "fictional characters"): + if subtypehumanoid == "fictional characters": subjectchooser = "fictional" - if(subtypehumanoid == "humanoids"): + if subtypehumanoid == "humanoids": subjectchooser = "humanoid" - if(subtypehumanoid == "based on job or title"): + if subtypehumanoid == "based on job or title": subjectchooser = "job" - if(subtypehumanoid == "based on first name"): + if subtypehumanoid == "based on first name": subjectchooser = "firstname" - if(mainchooser == "landscape"): + if mainchooser == "landscape": subjectchooser = "landscape" - if(mainchooser == "concept"): - #eventsubjectchooserlist = ["event", "concept", "poemline", "songline"] + if mainchooser == "concept": + # eventsubjectchooserlist = ["event", "concept", "poemline", "songline"] subjectchooser = random.choice(eventsubjectchooserlist) - if(subtypeconcept != "all"): - if(subtypeconcept == "event"): + if subtypeconcept != "all": + if subtypeconcept == "event": subjectchooser = "event" - if(subtypeconcept == "the X of Y concepts"): + if subtypeconcept == "the X of Y concepts": subjectchooser = "concept" - if(subtypeconcept == "lines from poems"): + if subtypeconcept == "lines from poems": subjectchooser = "poemline" - if(subtypeconcept == "lines from songs"): + if subtypeconcept == "lines from songs": subjectchooser = "songline" - if(subtypeconcept == "names from card based games"): + if subtypeconcept == "names from card based games": subjectchooser = "cardname" - if(subtypeconcept == "episode titles from tv shows"): + if subtypeconcept == "episode titles from tv shows": subjectchooser = "episodetitle" # After we chose the subject, lets set all things ready for He/She/It etc - - if(subjectchooser in ["manwomanmultiple"] and givensubject != "" and subtypehumanoid != "multiple humans"): + + if ( + subjectchooser in ["manwomanmultiple"] + and givensubject != "" + and subtypehumanoid != "multiple humans" + ): heshelist = ["they"] hisherlist = ["their"] himherlist = ["them"] # on rare occasions do "one of them" - if(random.randint(0,20) == 0): + if random.randint(0, 20) == 0: heshelist = ["one of them"] hisherlist = ["one of their"] himherlist = ["one of them"] - elif(subjectchooser in ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","firstname","manwomanmultiple"]): - if(gender == "male"): + elif subjectchooser in [ + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "firstname", + "manwomanmultiple", + ]: + if gender == "male": heshelist = ["he"] hisherlist = ["his"] himherlist = ["him"] - if(gender == "female"): + if gender == "female": heshelist = ["she"] hisherlist = ["her"] himherlist = ["her"] - if(subjectchooser in ["manwomanmultiple"] and givensubject == ""): + if subjectchooser in ["manwomanmultiple"] and givensubject == "": heshelist = ["they"] hisherlist = ["their"] himherlist = ["them"] # on rare occasions do "one of them" - if(random.randint(0,20) == 0): + if random.randint(0, 20) == 0: heshelist = ["one of them"] hisherlist = ["one of their"] himherlist = ["one of them"] - - - - - - # special modes + # special modes # start art blaster here - if(artblastermode==True): + if artblastermode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(artistlist)): + if uncommon_dist(insanitylevel) and bool(artistlist): completeprompt += "-artist-, " - if(uncommon_dist(insanitylevel) and bool(artmovementlist)): + if uncommon_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(vomitlist)): + if unique_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(unique_dist(insanitylevel) and bool(imagetypelist)): + if unique_dist(insanitylevel) and bool(imagetypelist): completeprompt += "-imagetype-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): + if unique_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - step = step + 1 + step = step + 1 # start unique art here - if(uniqueartmode==True): + if uniqueartmode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(othertypelist)): + if uncommon_dist(insanitylevel) and bool(othertypelist): completeprompt += "-othertype-, " - if(uncommon_dist(insanitylevel) and bool(artmovementlist)): + if uncommon_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(uncommon_dist(insanitylevel) and bool(colorschemelist)): + if uncommon_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): + if rare_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(rare_dist(insanitylevel) and bool(lightinglist)): + if rare_dist(insanitylevel) and bool(lightinglist): completeprompt += "-lighting-, " - if(unique_dist(insanitylevel) and bool(imagetypelist)): + if unique_dist(insanitylevel) and bool(imagetypelist): completeprompt += "-imagetype-, " - if(unique_dist(insanitylevel) and bool(qualitylist)): + if unique_dist(insanitylevel) and bool(qualitylist): completeprompt += "-quality-, " - - step = step + 1 + + step = step + 1 # start quality vomit here - if(qualityvomitmode==True): + if qualityvomitmode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(vomitlist)): + if uncommon_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(uncommon_dist(insanitylevel) and bool(qualitylist)): + if uncommon_dist(insanitylevel) and bool(qualitylist): completeprompt += "-quality-, " - if(unique_dist(insanitylevel) and bool(minivomitlist)): + if unique_dist(insanitylevel) and bool(minivomitlist): completeprompt += "-minivomit-, " - if(unique_dist(insanitylevel) and bool(artmovementlist)): + if unique_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): + if unique_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " step = step + 1 # start mood color here - if(colorcannonmode == True): + if colorcannonmode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(moodlist)): + if uncommon_dist(insanitylevel) and bool(moodlist): completeprompt += "-mood-, " - if(uncommon_dist(insanitylevel) and bool(colorschemelist)): + if uncommon_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): + if rare_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(unique_dist(insanitylevel) and bool(artmovementlist)): + if unique_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(lightinglist)): + if unique_dist(insanitylevel) and bool(lightinglist): completeprompt += "-lighting-, " - step = step + 1 + step = step + 1 # start photo fantasy here - if(photofantasymode == True): + if photofantasymode == True: step = 0 end = random.randint(1, insanitylevel) + 1 - if(common_dist(insanitylevel)): - if(uncommon_dist(insanitylevel)): + if common_dist(insanitylevel): + if uncommon_dist(insanitylevel): completeprompt += "-imagetypequality- " completeprompt += " photograph, " while step < end: - if(uncommon_dist(insanitylevel) and bool(lightinglist)): + if uncommon_dist(insanitylevel) and bool(lightinglist): completeprompt += "-photoaddition-, " - if(uncommon_dist(insanitylevel) and bool(lightinglist)): + if uncommon_dist(insanitylevel) and bool(lightinglist): completeprompt += "-lighting-, " - if(uncommon_dist(insanitylevel) and bool(cameralist)): + if uncommon_dist(insanitylevel) and bool(cameralist): completeprompt += "-camera-, " - if(rare_dist(insanitylevel) and bool(lenslist)): + if rare_dist(insanitylevel) and bool(lenslist): completeprompt += "-lens-, " - if(unique_dist(insanitylevel) and bool(moodlist)): + if unique_dist(insanitylevel) and bool(moodlist): completeprompt += "-mood-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): + if unique_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - step = step + 1 + step = step + 1 # start massive madness here - if(massivemadnessmode == True): + if massivemadnessmode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(rare_dist(insanitylevel) and bool(artistlist)): + if rare_dist(insanitylevel) and bool(artistlist): completeprompt += "-artist-, " - if(rare_dist(insanitylevel) and bool(descriptorlist)): + if rare_dist(insanitylevel) and bool(descriptorlist): completeprompt += "-descriptor-, " - if(rare_dist(insanitylevel) and bool(moodlist)): + if rare_dist(insanitylevel) and bool(moodlist): completeprompt += "-mood-, " - if(rare_dist(insanitylevel) and bool(colorschemelist)): + if rare_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): + if rare_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(rare_dist(insanitylevel) and bool(artmovementlist)): + if rare_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(rare_dist(insanitylevel) and bool(lightinglist)): + if rare_dist(insanitylevel) and bool(lightinglist): completeprompt += "-lighting-, " - if(rare_dist(insanitylevel) and bool(minilocationadditionslist)): + if rare_dist(insanitylevel) and bool(minilocationadditionslist): completeprompt += "-minilocationaddition-, " - if(rare_dist(insanitylevel) and bool(materiallist)): + if rare_dist(insanitylevel) and bool(materiallist): completeprompt += "-material-, " - if(rare_dist(insanitylevel) and bool(conceptsuffixlist)): + if rare_dist(insanitylevel) and bool(conceptsuffixlist): completeprompt += "-conceptsuffix-, " - if(rare_dist(insanitylevel) and bool(qualitylist)): + if rare_dist(insanitylevel) and bool(qualitylist): completeprompt += "-quality-, " - if(rare_dist(insanitylevel) and bool(cameralist)): + if rare_dist(insanitylevel) and bool(cameralist): completeprompt += "-camera-, " - if(rare_dist(insanitylevel) and bool(lenslist)): + if rare_dist(insanitylevel) and bool(lenslist): completeprompt += "-lens-, " - if(rare_dist(insanitylevel) and bool(imagetypelist)): + if rare_dist(insanitylevel) and bool(imagetypelist): completeprompt += "-imagetype-, " - step = step + 1 - + step = step + 1 - - # start styles mode here - if(stylesmode == True): + # start styles mode here + if stylesmode == True: chosenstyle = random.choice(styleslist) chosenstyleprefix = chosenstyle.split("-subject-")[0] - chosenstylesuffix= chosenstyle.split("-subject-")[1] + chosenstylesuffix = chosenstyle.split("-subject-")[1] completeprompt += chosenstyleprefix - - # start artist part - artistsplacement = "front" # remove the artistsatbackchange to be depended on the insanitylevel, we would like this to be a set chance - if(random.randint(0, 2) == 0 and onlyartists == False): + if random.randint(0, 2) == 0 and onlyartists == False: artistlocations = ["back", "middle"] artistsplacement = random.choice(artistlocations) - if(artists != "none" and artistsplacement == "front" and generateartist == True): + if artists != "none" and artistsplacement == "front" and generateartist == True: doartistnormal = True - if(artists == "greg mode"): + if artists == "greg mode": artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode-, " doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif(originalartistchoice == "all" and random.randint(0,3) == 0): - if(mainchooser in ["humanoid", "animal"]): + elif originalartistchoice == "all" and random.randint(0, 3) == 0: + if mainchooser in ["humanoid", "animal"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(mainchooser in ["landscape"]): + elif mainchooser in ["landscape"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(subjectchooser in ["building"]): + elif subjectchooser in ["building"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False # else sometimes to something like this? - elif(random.randint(0,5) == 0): + elif random.randint(0, 5) == 0: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-), OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-) and OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-)" + completeprompt += ( + random.choice(artistbylist) + + " OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-), OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-) and OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-)" + ) doartistnormal = False - - - if(doartistnormal): - + if doartistnormal: # take 1-3 artists, weighted to 1-2 step = random.randint(0, 1) minstep = step end = random.randint(1, insanitylevel3) - - - # determine artist mode: # normal # hybrid | @@ -1426,41 +1912,48 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # stopping at step x ::X # enhancing from step x - - - - modeselector = random.randint(0,10) + modeselector = random.randint(0, 10) if modeselector < 5 and end - step >= 2: - artistmodeslist = ["hybrid", "stopping", "adding", "switching", "enhancing"] + artistmodeslist = [ + "hybrid", + "stopping", + "adding", + "switching", + "enhancing", + ] artistmode = artistmodeslist[modeselector] - if(advancedprompting == False): + if advancedprompting == False: artistmode = "normal" - if (artistmode in ["hybrid","switching"] and end - step == 1): + if artistmode in ["hybrid", "switching"] and end - step == 1: artistmode = "normal" - - if(onlyartists == True and artistmode == "enhancing"): + + if onlyartists == True and artistmode == "enhancing": artistmode = "normal" # if there are not enough artists in the list, then just go normal - if(len(artistlist) < 3): + if len(artistlist) < 3: artistmode = "normal" - if(onlyartists == True and step == end): + if onlyartists == True and step == end: step = step - 1 - if artistmode in ["hybrid", "stopping", "adding","switching"]: + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += " [" - - while step < end: - if(normal_dist(insanitylevel)): + + while step < end: + if normal_dist(insanitylevel): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if(step == minstep): + # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if step == minstep: # sometimes do this - if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): - if(artiststyleselectormode == "normal"): + if ( + giventypeofimage == "" + and imagetype == "all" + and random.randint(0, 1) == 0 + ): + if artiststyleselectormode == "normal": completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -1468,161 +1961,287 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" - + completeprompt += ( + ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" + ) + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if artistmode not in ["hybrid", "switching"]and not end - step > 1: + + if artistmode not in ["hybrid", "switching"] and not end - step > 1: completeprompt += "," - elif artistmode not in ["hybrid", "switching"]and not end - step == 1: + elif ( + artistmode not in ["hybrid", "switching"] + and not end - step == 1 + ): completeprompt += " and " - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1,19)) - - if artistmode in ["switching","adding"]: - completeprompt += ":" + str(random.randint(1,18)) - if artistmode in ["hybrid", "stopping","adding", "switching"]: + completeprompt += str(random.randint(1, 19)) + + if artistmode in ["switching", "adding"]: + completeprompt += ":" + str(random.randint(1, 18)) + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += "] " - - if(onlyartists == True): - #Parse or statements + if onlyartists == True: + # Parse or statements completeprompt = parse_custom_functions(completeprompt, insanitylevel) # replace artist wildcards - completeprompt = replacewildcard(completeprompt, insanitylevel, "-artist-", artistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-gregmode-", gregmodelist, False, False) + completeprompt = replacewildcard( + completeprompt, insanitylevel, "-artist-", artistlist, False, False + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-gregmode-", + gregmodelist, + False, + False, + ) + + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-fantasyartist-", + fantasyartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-popularartist-", + popularartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-romanticismartist-", + romanticismartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-photographyartist-", + photographyartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-portraitartist-", + portraitartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-characterartist-", + characterartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-landscapeartist-", + landscapeartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-scifiartist-", + scifiartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-graphicdesignartist-", + graphicdesignartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-digitalartist-", + digitalartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-architectartist-", + architectartistlist, + False, + False, + ) + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + "-cinemaartist-", + cinemaartistlist, + False, + False, + ) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-fantasyartist-", fantasyartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-popularartist-", popularartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-romanticismartist-", romanticismartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-photographyartist-", photographyartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-portraitartist-", portraitartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-characterartist-", characterartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-landscapeartist-", landscapeartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-scifiartist-", scifiartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-graphicdesignartist-", graphicdesignartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-digitalartist-", digitalartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-architectartist-", architectartistlist, False, False) - completeprompt = replacewildcard(completeprompt, insanitylevel, "-cinemaartist-", cinemaartistlist, False, False) - # clean it up - completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) + completeprompt = cleanup( + completeprompt, advancedprompting, insanitylevel + ) print("only generated these artists:" + completeprompt) return completeprompt - completeprompt += ", " - # sometimes do this as well - if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 2) == 0): + if ( + giventypeofimage == "" + and imagetype == "all" + and random.randint(0, 2) == 0 + ): completeprompt += "-artiststyle- art, " - if artistmode in ["enhancing"]: completeprompt += " [" - - # start image type - if(giventypeofimage=="" and generatetype == True): - 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"): + if giventypeofimage == "" and generatetype == True: + 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 += random.choice(othertypelist) - - if(imagetype == "all" and chance_roll(insanitylevel, imagetypechance) and amountofimagetypes <= 1): + + if ( + imagetype == "all" + and chance_roll(insanitylevel, imagetypechance) + and amountofimagetypes <= 1 + ): amountofimagetypes = 1 - - for i in range(amountofimagetypes): - # one in 6 images is a complex/other type - if((chance_roll(insanitylevel, imagetypequalitychance) or originalartistchoice == "greg mode") and generateimagetypequality): + # one in 6 images is a complex/other type + if ( + chance_roll(insanitylevel, imagetypequalitychance) + or originalartistchoice == "greg mode" + ) and generateimagetypequality: completeprompt += "-imagetypequality- " - # if("photography" in artiststyleselector - # or "photography" in artists): - # completeprompt += " photograph, " - # elif("portrait" in artiststyleselector - # or "portrait" in artists): - # completeprompt += " portrait, " - # if("landscape" in artiststyleselector - # or "landscape" in artists): - # completeprompt += " landscape, " + # if("photography" in artiststyleselector + # or "photography" in artists): + # completeprompt += " photograph, " + # elif("portrait" in artiststyleselector + # or "portrait" in artists): + # completeprompt += " portrait, " + # if("landscape" in artiststyleselector + # or "landscape" in artists): + # completeprompt += " landscape, " - # woops, never to this as wildcards. We need to know as early as possible wether something is a photo. Lets put it back! - elif(random.randint(0,5) < 5): + # woops, never to this as wildcards. We need to know as early as possible wether something is a photo. Lets put it back! + elif random.randint(0, 5) < 5: completeprompt += " " + random.choice(imagetypelist) + ", " else: othertype = 1 completeprompt += " " + random.choice(othertypelist) + ", " - - if(othertype==1): + + if othertype == 1: completeprompt += " of a " else: completeprompt += ", " - elif(generatetype == True): + elif generatetype == True: othertype = 1 completeprompt += giventypeofimage + " of a " - - ### here we can do some other stuff to spice things up - if(chance_roll(insanitylevel, minilocationadditionchance) and generateminilocationaddition == True): + if ( + chance_roll(insanitylevel, minilocationadditionchance) + and generateminilocationaddition == True + ): completeprompt += " -minilocationaddition-, " - - if(chance_roll(insanitylevel, artmovementprefixchance) and generateartmovement == True): + + if ( + chance_roll(insanitylevel, artmovementprefixchance) + and generateartmovement == True + ): generateartmovement = False completeprompt += " -artmovement-, " - - if(chance_roll(insanitylevel, minivomitprefix1chance) and generateminivomit == True): - completeprompt += " -minivomit-, " - - if(chance_roll(insanitylevel, minivomitprefix2chance) and generateminivomit == True): + + if ( + chance_roll(insanitylevel, minivomitprefix1chance) + and generateminivomit == True + ): completeprompt += " -minivomit-, " + if ( + chance_roll(insanitylevel, minivomitprefix2chance) + and generateminivomit == True + ): + completeprompt += " -minivomit-, " - # start shot size - if(mainchooser in ["object", "animal", "humanoid", "concept"] and othertype == 0 and "portrait" not in completeprompt and generateshot == True and chance_roll(insanitylevel,shotsizechance)): + if ( + mainchooser in ["object", "animal", "humanoid", "concept"] + and othertype == 0 + and "portrait" not in completeprompt + and generateshot == True + and chance_roll(insanitylevel, shotsizechance) + ): completeprompt += "-shotsize- of a " - elif("portrait" in completeprompt and generateshot == True): + elif "portrait" in completeprompt and generateshot == True: completeprompt += " ,close up of a " - elif(mainchooser in ["landscape"] and generateshot == True): + elif mainchooser in ["landscape"] and generateshot == True: completeprompt += " landscape of a " - elif(generateshot == True): + elif generateshot == True: completeprompt += ", " - + genjoboractivity = False # start subject building - - # divider between subject and everything else - completeprompt += " @ " - - if(generatesubject == True): - # start with descriptive qualities + if generatesubject == True: + # start with descriptive qualities # Once in a very rare while, we get a ... full of ...s - if(novel_dist(insanitylevel) and subjectchooser in ["animal", "animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","firstname"]): + if novel_dist(insanitylevel) and subjectchooser in [ + "animal", + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "firstname", + ]: buildingfullmode = True insideshot = 1 heshelist = ["they"] @@ -1630,67 +2249,136 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all himherlist = ["them"] completeprompt += "a OR(-building-;-location-;-waterlocation-;-container-;rare) full of " - # Sometimes the descriptors are at the back, in more natural language. Lets determine. - descriptorsintheback = random.randint(0,2) - if(descriptorsintheback < 2): + descriptorsintheback = random.randint(0, 2) + if descriptorsintheback < 2: # Common to have 1 description, uncommon to have 2 - if(chance_roll(insanitylevel, subjectdescriptor1chance) and generatedescriptors == True): - if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"]): + if ( + chance_roll(insanitylevel, subjectdescriptor1chance) + and generatedescriptors == True + ): + if subjectchooser in [ + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ]: completeprompt += "-humandescriptor- " - elif(mainchooser == "landscape"): + elif mainchooser == "landscape": completeprompt += "-locationdescriptor- " - elif(mainchooser == "animal"): + elif mainchooser == "animal": completeprompt += "-animaldescriptor- " else: completeprompt += "-descriptor- " - if(chance_roll(insanitylevel, subjectdescriptor2chance) and generatedescriptors == True): - if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"]): + if ( + chance_roll(insanitylevel, subjectdescriptor2chance) + and generatedescriptors == True + ): + if subjectchooser in [ + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ]: completeprompt += "-humandescriptor- " - elif(mainchooser == "landscape"): + elif mainchooser == "landscape": completeprompt += "-locationdescriptor- " - elif(mainchooser == "animal"): + elif mainchooser == "animal": completeprompt += "-animaldescriptor- " else: completeprompt += "-descriptor- " - + # color, for animals, landscape, objects and concepts - if(mainchooser in ["animal", "object", "landscape", "concept"] and unique_dist(insanitylevel)): + if mainchooser in [ + "animal", + "object", + "landscape", + "concept", + ] and unique_dist(insanitylevel): completeprompt += " OR(-color-;-colorcombination-) " - - # age, very rare to add. - if(subjectchooser in ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and extraordinary_dist(insanitylevel)): - completeprompt += str(random.randint(20,99)) + " OR(y.o.;year old) " - if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, subjectbodytypechance) and generatebodytype == True): + # age, very rare to add. + if subjectchooser in [ + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] and extraordinary_dist(insanitylevel): + completeprompt += str(random.randint(20, 99)) + " OR(y.o.;year old) " + + if ( + subjectchooser + in [ + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, subjectbodytypechance) + and generatebodytype == True + ): completeprompt += "-bodytype- " - if(subjectchooser in ["object","animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, subjectculturechance) and generatedescriptors == True): + if ( + subjectchooser + in [ + "object", + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, subjectculturechance) + and generatedescriptors == True + ): completeprompt += "-culture- " - if(mainchooser == "object"): + if mainchooser == "object": # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" # if we have an overwrite, then make sure we only take the override - if(subtypeobject != "all"): - if(subtypeobject == "generic objects"): + if subtypeobject != "all": + if subtypeobject == "generic objects": objectwildcardlist = ["-object-"] - if(subtypeobject == "vehicles"): + if subtypeobject == "vehicles": objectwildcardlist = ["-vehicle-"] - if(subtypeobject == "food"): + if subtypeobject == "food": objectwildcardlist = ["-food-"] - if(subtypeobject == "buildings"): + if subtypeobject == "buildings": objectwildcardlist = ["-building-"] - if(subtypeobject == "space"): + if subtypeobject == "space": objectwildcardlist = ["-space-"] - if(subtypeobject == "flora"): + if subtypeobject == "flora": objectwildcardlist = ["-flora-"] - - # if we have a given subject, we should skip making an actual subject - if(givensubject == ""): - if(rare_dist(insanitylevel) and advancedprompting == True): + # if we have a given subject, we should skip making an actual subject + if givensubject == "": + if rare_dist(insanitylevel) and advancedprompting == True: hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" @@ -1699,294 +2387,433 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all completeprompt += chosenobjectwildcard + " " - if(hybridorswap == "hybrid"): - if(uncommon_dist(insanitylevel)): - completeprompt += "|" + random.choice(objectwildcardlist) + "] " + if hybridorswap == "hybrid": + if uncommon_dist(insanitylevel): + completeprompt += ( + "|" + random.choice(objectwildcardlist) + "] " + ) else: - completeprompt += "|" + completeprompt += "|" completeprompt += chosenobjectwildcard + " " completeprompt += "] " - if(hybridorswap == "swap"): - if(uncommon_dist(insanitylevel)): - completeprompt += ":" + random.choice(objectwildcardlist) + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "swap": + if uncommon_dist(insanitylevel): + completeprompt += ( + ":" + + random.choice(objectwildcardlist) + + ":" + + str(random.randint(1, 5)) + + "] " + ) else: completeprompt += ":" completeprompt += chosenobjectwildcard + " " - completeprompt += ":" + str(random.randint(1,5)) + "] " + completeprompt += ":" + str(random.randint(1, 5)) + "] " else: completeprompt += " " + givensubject + " " - + hybridorswap = "" - if(mainchooser == "animal"): + if mainchooser == "animal": # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - - # if we have a given subject, we should skip making an actual subject - if(givensubject == ""): - if(rare_dist(insanitylevel) and advancedprompting == True): + # if we have a given subject, we should skip making an actual subject + if givensubject == "": + if rare_dist(insanitylevel) and advancedprompting == True: hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - - if(unique_dist(insanitylevel) and generateanimaladdition == True): + + if unique_dist(insanitylevel) and generateanimaladdition == True: animaladdedsomething = 1 completeprompt += "-animaladdition- -animal- " - if(animaladdedsomething != 1): + if animaladdedsomething != 1: completeprompt += "-animal- " - - - if(hybridorswap == "hybrid"): - if(uncommon_dist(insanitylevel)): + if hybridorswap == "hybrid": + if uncommon_dist(insanitylevel): completeprompt += "|" + random.choice(hybridlist) + "] " else: completeprompt += "| -animal- ] " - if(hybridorswap == "swap"): - if(uncommon_dist(insanitylevel)): - completeprompt += ":" + random.choice(hybridlist) + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "swap": + if uncommon_dist(insanitylevel): + completeprompt += ( + ":" + + random.choice(hybridlist) + + ":" + + str(random.randint(1, 5)) + + "] " + ) else: - completeprompt += ":-animal-:" + str(random.randint(1,5)) + "] " + completeprompt += ( + ":-animal-:" + str(random.randint(1, 5)) + "] " + ) else: completeprompt += " " + givensubject + " " - + hybridorswap = "" - # move job or activity logic here. We want to place it at 2 different places maybe - - if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, joboractivitychance) and humanspecial != 1 and generatesubject == True): - genjoboractivity = True - genjoboractivitylocationslist = ["front","middle", "middle","back","back", "back"] - genjoboractivitylocation = random.choice(genjoboractivitylocationslist) - + # move job or activity logic here. We want to place it at 2 different places maybe - if(genjoboractivity and genjoboractivitylocation=="front"): + if ( + subjectchooser + in [ + "animal as human", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, joboractivitychance) + and humanspecial != 1 + and generatesubject == True + ): + genjoboractivity = True + genjoboractivitylocationslist = [ + "front", + "middle", + "middle", + "back", + "back", + "back", + ] + genjoboractivitylocation = random.choice(genjoboractivitylocationslist) + + if genjoboractivity and genjoboractivitylocation == "front": completeprompt += "-job- " - - + # if we have a given subject, we should skip making an actual subject - if(mainchooser == "humanoid"): + if mainchooser == "humanoid": # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - if(givensubject==""): - - if(subjectchooser == "human"): + if givensubject == "": + if subjectchooser == "human": completeprompt += "-manwoman-" - - if(subjectchooser == "manwomanrelation"): + + if subjectchooser == "manwomanrelation": completeprompt += "-manwomanrelation-" - if(subjectchooser == "manwomanmultiple"): + if subjectchooser == "manwomanmultiple": completeprompt += "-manwomanmultiple-" - if(subjectchooser == "job"): + if subjectchooser == "job": completeprompt += "-malefemale- " completeprompt += "-job-" - if(subjectchooser == "fictional"): - if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): + if subjectchooser == "fictional": + if ( + rare_dist(insanitylevel) + and advancedprompting == True + and buildingfullmode == False + ): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + # Sometimes, we do a gender swap. Much fun! - if(novel_dist(insanitylevel)): + if novel_dist(insanitylevel): completeprompt += gender + " version of -oppositefictional-" else: completeprompt += "-fictional-" - if(hybridorswap == "hybrid"): - completeprompt += "|" + random.choice(hybridhumanlist) + " ] " - if(hybridorswap == "swap"): - completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "hybrid": + completeprompt += ( + "|" + random.choice(hybridhumanlist) + " ] " + ) + if hybridorswap == "swap": + completeprompt += ( + ":" + + random.choice(hybridhumanlist) + + ":" + + str(random.randint(1, 5)) + + "] " + ) hybridorswap = "" - if(subjectchooser == "non fictional"): - if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): + if subjectchooser == "non fictional": + if ( + rare_dist(insanitylevel) + and advancedprompting == True + and buildingfullmode == False + ): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" # Sometimes, we do a gender swap. Much fun! - if(novel_dist(insanitylevel)): - completeprompt += gender + " version of -oppositenonfictional-" + if novel_dist(insanitylevel): + completeprompt += ( + gender + " version of -oppositenonfictional-" + ) else: completeprompt += "-nonfictional-" - if(hybridorswap == "hybrid"): - completeprompt += "|" + random.choice(hybridhumanlist) + "] " - if(hybridorswap == "swap"): - completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "hybrid": + completeprompt += ( + "|" + random.choice(hybridhumanlist) + "] " + ) + if hybridorswap == "swap": + completeprompt += ( + ":" + + random.choice(hybridhumanlist) + + ":" + + str(random.randint(1, 5)) + + "] " + ) hybridorswap = "" - if(subjectchooser == "humanoid"): - if(gender != "all"): + if subjectchooser == "humanoid": + if gender != "all": completeprompt += "-malefemale- " - if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): + if ( + rare_dist(insanitylevel) + and advancedprompting == True + and buildingfullmode == False + ): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-humanoid-" - if(hybridorswap == "hybrid"): - completeprompt += "|" + random.choice(hybridhumanlist) + "] " - if(hybridorswap == "swap"): - completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "hybrid": + completeprompt += ( + "|" + random.choice(hybridhumanlist) + "] " + ) + if hybridorswap == "swap": + completeprompt += ( + ":" + + random.choice(hybridhumanlist) + + ":" + + str(random.randint(1, 5)) + + "] " + ) hybridorswap = "" - if(subjectchooser == "firstname"): - if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): + if subjectchooser == "firstname": + if ( + rare_dist(insanitylevel) + and advancedprompting == True + and buildingfullmode == False + ): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-firstname-" - if(hybridorswap == "hybrid"): + if hybridorswap == "hybrid": completeprompt += "|" + "-firstname-" + "] " - if(hybridorswap == "swap"): - completeprompt += ":" + "-firstname-" + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "swap": + completeprompt += ( + ":" + + "-firstname-" + + ":" + + str(random.randint(1, 5)) + + "] " + ) hybridorswap = "" - if(buildingfullmode == True): + if buildingfullmode == True: completeprompt += "s" completeprompt += " " else: - if(subjectchooser == "manwomanmultiple" and subtypehumanoid != "multiple humans" and givensubject not in ["1girl", "1boy", "solo"]): - if(random.randint(0,1) == 1): - completeprompt += " " + givensubject + " and a -manwomanmultiple- " + if ( + subjectchooser == "manwomanmultiple" + and subtypehumanoid != "multiple humans" + and givensubject not in ["1girl", "1boy", "solo"] + ): + if random.randint(0, 1) == 1: + completeprompt += ( + " " + givensubject + " and a -manwomanmultiple- " + ) else: - completeprompt += " a OR(group;couple;crowd;bunch) of " + givensubject + " " + completeprompt += ( + " a OR(group;couple;crowd;bunch) of " + + givensubject + + " " + ) else: - completeprompt += " " + givensubject + " " - - - # sometimes add a suffix for more fun! - if( (mainchooser == "humanoid" or mainchooser == "animal" or mainchooser == "object") and chance_roll(insanitylevel, subjectconceptsuffixchance)): + completeprompt += " " + givensubject + " " + + # sometimes add a suffix for more fun! + if ( + mainchooser == "humanoid" + or mainchooser == "animal" + or mainchooser == "object" + ) and chance_roll(insanitylevel, subjectconceptsuffixchance): completeprompt += " of -conceptsuffix- " - if(mainchooser == "humanoid" or mainchooser == "animal" or mainchooser == "object"): - # completion of strenght end - completeprompt += "-objectstrengthend-" - - if(mainchooser == 'animal' and legendary_dist(insanitylevel)): + if ( + mainchooser == "humanoid" + or mainchooser == "animal" + or mainchooser == "object" + ): + # completion of strenght end + completeprompt += "-objectstrengthend-" + + if mainchooser == "animal" and legendary_dist(insanitylevel): animaladdedsomething = 1 completeprompt += " -animalsuffixaddition- " - - - if(subjectchooser == "landscape"): + + if subjectchooser == "landscape": # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - + # if we have a given subject, we should skip making an actual subject - if(givensubject == ""): - if(rare_dist(insanitylevel) and advancedprompting == True): + if givensubject == "": + if rare_dist(insanitylevel) and advancedprompting == True: hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-location- " - if(hybridorswap == "hybrid"): - completeprompt += "|" + "-location-" + "] " - if(hybridorswap == "swap"): - completeprompt += ":" + "-location-" + ":" + str(random.randint(1,5)) + "] " + if hybridorswap == "hybrid": + completeprompt += "|" + "-location-" + "] " + if hybridorswap == "swap": + completeprompt += ( + ":" + "-location-" + ":" + str(random.randint(1, 5)) + "] " + ) else: - completeprompt += " " + givensubject + " " - + completeprompt += " " + givensubject + " " + hybridorswap = "" # completion of strenght end completeprompt += "-objectstrengthend-" # shots from inside can create cool effects in landscapes - if(chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) and insideshot == 0): + if ( + chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) + and insideshot == 0 + ): insideshot = 1 # lets cheat a bit here, we can do something cool I saw on reddit - if(mainchooser=="humanoid" and legendary_dist(insanitylevel)): + if mainchooser == "humanoid" and legendary_dist(insanitylevel): completeprompt += " looking at a -addontolocationinside- " - elif(mainchooser=="humanoid" and legendary_dist(insanitylevel)): + elif mainchooser == "humanoid" and legendary_dist(insanitylevel): completeprompt += " facing a -addontolocationinside- " - elif(legendary_dist(insanitylevel)): - completeprompt += " in the distance there is a -addontolocationinside- " + elif legendary_dist(insanitylevel): + completeprompt += ( + " in the distance there is a -addontolocationinside- " + ) else: completeprompt += " from inside of a -addontolocationinside- " - if(chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) and insideshot == 0): + if ( + chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) + and insideshot == 0 + ): completeprompt += " and " - if(chance_roll(insanitylevel, subjectlandscapeaddonlocationdescriptorchance)): - completeprompt += "-locationdescriptor- " - if(chance_roll(insanitylevel, subjectlandscapeaddonlocationculturechance)): + if chance_roll( + insanitylevel, subjectlandscapeaddonlocationdescriptorchance + ): + completeprompt += "-locationdescriptor- " + if chance_roll( + insanitylevel, subjectlandscapeaddonlocationculturechance + ): completeprompt += "-culture- " - #addontolocation = [locationlist,buildinglist, vehiclelist] + # addontolocation = [locationlist,buildinglist, vehiclelist] completeprompt += "-addontolocation- " - - if(mainchooser == "concept"): + if mainchooser == "concept": # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - if(givensubject == ""): - if(subjectchooser == "event"): - completeprompt += " \"" + random.choice(eventlist) + "\" " - - if(subjectchooser == "concept"): - completeprompt += " \" The -conceptprefix- of -conceptsuffix- \" " + if givensubject == "": + if subjectchooser == "event": + completeprompt += ' "' + random.choice(eventlist) + '" ' - if(subjectchooser == "poemline"): - completeprompt += " \" -poemline- \" " + if subjectchooser == "concept": + completeprompt += ' " The -conceptprefix- of -conceptsuffix- " ' - if(subjectchooser == "songline"): - completeprompt += " \" -songline- \" " + if subjectchooser == "poemline": + completeprompt += ' " -poemline- " ' - if(subjectchooser == "cardname"): - completeprompt += " \" -cardname- \" " + if subjectchooser == "songline": + completeprompt += ' " -songline- " ' - if(subjectchooser == "episodetitle"): - completeprompt += " \" -episodetitle- \" " + if subjectchooser == "cardname": + completeprompt += ' " -cardname- " ' + + if subjectchooser == "episodetitle": + completeprompt += ' " -episodetitle- " ' - # making subject override work with X and Y concepts, much fun! - elif(givensubject != "" and subjectchooser == "concept"): - if(random.randint(0,3) == 0): - completeprompt += " \" The -conceptprefix- of " + givensubject + " \" " - else: - completeprompt += " \" The " + givensubject + " of -conceptsuffix- \" " + elif givensubject != "" and subjectchooser == "concept": + if random.randint(0, 3) == 0: + completeprompt += ( + ' " The -conceptprefix- of ' + givensubject + ' " ' + ) + else: + completeprompt += ( + ' " The ' + givensubject + ' of -conceptsuffix- " ' + ) else: - completeprompt += " " + givensubject + " " + completeprompt += " " + givensubject + " " # completion of strenght end completeprompt += "-objectstrengthend-" - if(genjoboractivity and genjoboractivitylocation=="middle"): - joboractivitylist = [joblist,humanactivitylist] + if genjoboractivity and genjoboractivitylocation == "middle": + joboractivitylist = [joblist, humanactivitylist] completeprompt += random.choice(random.choice(joboractivitylist)) + ", " - - - if(descriptorsintheback == 2): + + if descriptorsintheback == 2: # Common to have 1 description, uncommon to have 2 - if(chance_roll(insanitylevel, subjectdescriptor1chance) and generatedescriptors == True): - if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"]): - if(random.randint(0,3) > 0): + if ( + chance_roll(insanitylevel, subjectdescriptor1chance) + and generatedescriptors == True + ): + if subjectchooser in [ + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ]: + if random.randint(0, 3) > 0: completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -humandescriptor- " - elif(subjectchooser == "manwomanmultiple"): + elif subjectchooser == "manwomanmultiple": completeprompt += ", the -samehumansubject- are OR(;very;rare) -humandescriptor-" else: completeprompt += ", OR(the -manwoman-;-samehumansubject-) is OR(;very;rare) -humandescriptor-" - elif(mainchooser == "landscape"): + elif mainchooser == "landscape": completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -locationdescriptor- " - elif(mainchooser == "animal"): + elif mainchooser == "animal": completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -animaldescriptor- " else: - completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -descriptor- " + completeprompt += ( + ", OR(;-heshe- is;normal) OR(;very;rare) -descriptor- " + ) - if(chance_roll(insanitylevel, subjectdescriptor2chance) and generatedescriptors == True): - if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"]): + if ( + chance_roll(insanitylevel, subjectdescriptor2chance) + and generatedescriptors == True + ): + if subjectchooser in [ + "animal as human,", + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ]: completeprompt += " and -humandescriptor- " - elif(mainchooser == "landscape"): + elif mainchooser == "landscape": completeprompt += " and -locationdescriptor- " - elif(mainchooser == "animal"): + elif mainchooser == "animal": completeprompt += " and -animaldescriptor- " else: completeprompt += " and -descriptor- " @@ -1994,153 +2821,289 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # object additions for i in range(objectadditionsrepeats): - if(mainchooser == "object" and chance_roll(insanitylevel, objectadditionschance) and generateobjectaddition == True): + if ( + mainchooser == "object" + and chance_roll(insanitylevel, objectadditionschance) + and generateobjectaddition == True + ): completeprompt += ", -objectaddition- , " - - + # riding an animal, holding an object or driving a vehicle, rare - if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, humanadditionchance) and generatehumanaddition == True): + if ( + subjectchooser + in [ + "animal as human,", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, humanadditionchance) + and generatehumanaddition == True + ): humanspecial = 1 completeprompt += "-humanaddition- " - + completeprompt += ", " # unique additions for all types: - if(chance_roll(insanitylevel, overalladditionchance) and generateoveralladdition == True): + if ( + chance_roll(insanitylevel, overalladditionchance) + and generateoveralladdition == True + ): completeprompt += "-overalladdition- " - - - - # SD understands emoji's. Can be used to manipulate facial expressions. # emoji, legendary - if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, emojichance) and generateemoji== True): + if ( + subjectchooser + in [ + "animal as human,", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, emojichance) + and generateemoji == True + ): completeprompt += "-emoji-, " # human expressions - if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, humanexpressionchance) and generatehumanexpression== True): + if ( + subjectchooser + in [ + "animal as human,", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, humanexpressionchance) + and generatehumanexpression == True + ): completeprompt += "-humanexpression-, " - # cosplaying - #if(subjectchooser in ["animal as human", "non fictional", "humanoid"] and rare_dist(insanitylevel) and humanspecial != 1): + # if(subjectchooser in ["animal as human", "non fictional", "humanoid"] and rare_dist(insanitylevel) and humanspecial != 1): # completeprompt += "cosplaying as " + random.choice(fictionallist) + ", " - # Job + # Job # either go job or activity, not both - if(genjoboractivity and genjoboractivitylocation=="back"): - joboractivitylist = [joblist,humanactivitylist] - completeprompt += ", " + random.choice(random.choice(joboractivitylist)) + ", " - + if genjoboractivity and genjoboractivitylocation == "back": + joboractivitylist = [joblist, humanactivitylist] + completeprompt += ( + ", " + random.choice(random.choice(joboractivitylist)) + ", " + ) # if(subjectchooser in ["animal as human","human","job", "fictional", "non fictional", "humanoid"] and legendary_dist(insanitylevel)): # skintypelist = ["-color-", "-material-"] # completeprompt += ", with " + random.choice(skintypelist) + " skin, " # add face builder sometimes on generic humans - if(subjectchooser in ["human", "humanoid", "manwomanrelation","firstname"] and chance_roll(insanitylevel, buildfacechance) and generateface== True): + if ( + subjectchooser in ["human", "humanoid", "manwomanrelation", "firstname"] + and chance_roll(insanitylevel, buildfacechance) + and generateface == True + ): completeprompt += random.choice(buildfacelist) + ", " - - - # custom mid list for i in range(custominputmidrepeats): - if(chance_roll(insanitylevel, custominputmidchance) and generatecustominputmid == True): + if ( + chance_roll(insanitylevel, custominputmidchance) + and generatecustominputmid == True + ): completeprompt += random.choice(custominputmidlist) + ", " - - # add in some more mini vomits - if(chance_roll(insanitylevel, minivomitmidchance) and generateminivomit == True): - completeprompt += " -minivomit-, " - - # outfit builder - if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, outfitchance) and generateoutfit == True and humanspecial != 1): - completeprompt += " " + random.choice(buildoutfitlist) + ", " - if(extraordinary_dist(insanitylevel)): - completeprompt += " -outfitvomit-, " - elif(overrideoutfit != "" and imagetype != "only templates mode"): - completeprompt += " " + random.choice(buildoutfitlist) + ", " - if(extraordinary_dist(insanitylevel)): - completeprompt += " -outfitvomit-, " - - - if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, posechance) and humanspecial != 1 and generatepose == True): + # add in some more mini vomits + if chance_roll(insanitylevel, minivomitmidchance) and generateminivomit == True: + completeprompt += " -minivomit-, " + + # outfit builder + if ( + subjectchooser + in [ + "animal as human", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, outfitchance) + and generateoutfit == True + and humanspecial != 1 + ): + completeprompt += " " + random.choice(buildoutfitlist) + ", " + if extraordinary_dist(insanitylevel): + completeprompt += " -outfitvomit-, " + elif overrideoutfit != "" and imagetype != "only templates mode": + completeprompt += " " + random.choice(buildoutfitlist) + ", " + if extraordinary_dist(insanitylevel): + completeprompt += " -outfitvomit-, " + + if ( + subjectchooser + in [ + "animal as human", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, posechance) + and humanspecial != 1 + and generatepose == True + ): completeprompt += random.choice(poselist) + ", " - - if(subjectchooser in ["human","job","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, hairchance) and generatehairstyle == True): + + if ( + subjectchooser + in [ + "human", + "job", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, hairchance) + and generatehairstyle == True + ): completeprompt += random.choice(buildhairlist) + ", " - if(unique_dist(insanitylevel)): + if unique_dist(insanitylevel): completeprompt += " -hairvomit-, " - if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, accessorychance) and generateaccessorie == True and generateaccessories == True): + if ( + subjectchooser + in [ + "animal as human,", + "human", + "fictional", + "non fictional", + "humanoid", + "manwomanrelation", + "manwomanmultiple", + "firstname", + ] + and chance_roll(insanitylevel, accessorychance) + and generateaccessorie == True + and generateaccessories == True + ): completeprompt += random.choice(buildaccessorielist) + ", " - if(chance_roll(insanitylevel, humanoidinsideshotchance) and subjectchooser not in ["landscape", "concept"] and generateinsideshot == True): + if ( + chance_roll(insanitylevel, humanoidinsideshotchance) + and subjectchooser not in ["landscape", "concept"] + and generateinsideshot == True + ): insideshot = 1 completeprompt += random.choice(insideshotlist) + ", " - - if(subjectchooser not in ["landscape", "concept"] and humanspecial != 1 and insideshot == 0 and chance_roll(insanitylevel, humanoidbackgroundchance) and generatebackground == True): + + if ( + subjectchooser not in ["landscape", "concept"] + and humanspecial != 1 + and insideshot == 0 + and chance_roll(insanitylevel, humanoidbackgroundchance) + and generatebackground == True + ): completeprompt += random.choice(backgroundtypelist) + ", " # minilocation bit - if(subjectchooser in ["landscape"] and chance_roll(insanitylevel, landscapeminilocationchance) and generateminilocationaddition == True): - completeprompt += " -minilocationaddition-, " - - if(chance_roll(insanitylevel, generalminilocationchance) and generateminilocationaddition == True): + if ( + subjectchooser in ["landscape"] + and chance_roll(insanitylevel, landscapeminilocationchance) + and generateminilocationaddition == True + ): completeprompt += " -minilocationaddition-, " - - # divider between subject and everything else - completeprompt += " @ " - + if ( + chance_roll(insanitylevel, generalminilocationchance) + and generateminilocationaddition == True + ): + completeprompt += " -minilocationaddition-, " # Add more quality while in greg mode lol - if(originalartistchoice == "greg mode" and generatequality == True): + if originalartistchoice == "greg mode" and generatequality == True: completeprompt += "-quality-, " # landscapes it is nice to always have a time period - if(chance_roll(insanitylevel, timperiodchance) or subjectchooser=="landscape"): - if(generatetimeperiod == True): + if chance_roll(insanitylevel, timperiodchance) or subjectchooser == "landscape": + if generatetimeperiod == True: completeprompt += "-timeperiod-, " - if(mainchooser not in ["landscape"] and chance_roll(insanitylevel, focuschance) and generatefocus == True): + if ( + mainchooser not in ["landscape"] + and chance_roll(insanitylevel, focuschance) + and generatefocus == True + ): completeprompt += "-focus-, " - # artists in the middle, can happen as well: - if(artists != "none" and artistsplacement == "middle" and generateartist == True): + if ( + artists != "none" + and artistsplacement == "middle" + and generateartist == True + ): completeprompt += ", " doartistnormal = True - if(artists == "greg mode"): + if artists == "greg mode": artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode-, " doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif(originalartistchoice == "all" and random.randint(0,3) == 0): - if(mainchooser in ["humanoid", "animal"]): + elif originalartistchoice == "all" and random.randint(0, 3) == 0: + if mainchooser in ["humanoid", "animal"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(mainchooser in ["landscape"]): + elif mainchooser in ["landscape"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(subjectchooser in ["building"]): + elif subjectchooser in ["building"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - - if(doartistnormal): - + + if doartistnormal: # sometimes do this as well, but now in the front of the artists - if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 2) == 0): + if ( + giventypeofimage == "" + and imagetype == "all" + and random.randint(0, 2) == 0 + ): completeprompt += "-artiststyle- art, " # take 1-3 artists, weighted to 1-2 @@ -2148,9 +3111,6 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all minstep = step end = random.randint(1, insanitylevel3) - - - # determine artist mode: # normal # hybrid | @@ -2158,34 +3118,37 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # adding at step x a:X # stopping at step x ::X - - modeselector = random.randint(0,10) + modeselector = random.randint(0, 10) if modeselector < 4 and end - step >= 2: artistmodeslist = ["hybrid", "stopping", "adding", "switching"] artistmode = artistmodeslist[modeselector] - if(advancedprompting == False): + if advancedprompting == False: artistmode = "normal" - if artistmode in ["hybrid","switching"] and end - step == 1: + if artistmode in ["hybrid", "switching"] and end - step == 1: artistmode = "normal" # if there are not enough artists in the list, then just go normal - if(len(artistlist) < 3): + if len(artistlist) < 3: artistmode = "normal" - - if artistmode in ["hybrid", "stopping", "adding","switching"]: + + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += " [" - - while step < end: - if(normal_dist(insanitylevel)): + + while step < end: + if normal_dist(insanitylevel): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if(step == minstep): + # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if step == minstep: # sometimes do this - if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): - if(artiststyleselectormode == "normal"): + if ( + giventypeofimage == "" + and imagetype == "all" + and random.randint(0, 1) == 0 + ): + if artiststyleselectormode == "normal": completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -2193,290 +3156,320 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" - + completeprompt += ( + ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" + ) + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if artistmode not in ["hybrid", "switching"]and not end - step == 1: + + if ( + artistmode not in ["hybrid", "switching"] + and not end - step == 1 + ): completeprompt += "," - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1,19)) - - if artistmode in ["switching","adding"]: - completeprompt += ":" + str(random.randint(1,18)) - if artistmode in ["hybrid", "stopping","adding", "switching"]: + completeprompt += str(random.randint(1, 19)) + + if artistmode in ["switching", "adding"]: + completeprompt += ":" + str(random.randint(1, 18)) + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += "] " - + completeprompt += ", " # end of the artist stuff # Add more quality while in greg mode lol - if(originalartistchoice == "greg mode" and generatequality == True): + if originalartistchoice == "greg mode" and generatequality == True: completeprompt += "-quality-, " # others - if(chance_roll(max(1,insanitylevel -1), directionchance) and generatedirection == True): + if ( + chance_roll(max(1, insanitylevel - 1), directionchance) + and generatedirection == True + ): completeprompt += "-direction-, " - if(chance_roll(insanitylevel, moodchance) and generatemood == True): - completeprompt += "-mood-, " + if chance_roll(insanitylevel, moodchance) and generatemood == True: + completeprompt += "-mood-, " # add in some more mini vomits - if(chance_roll(insanitylevel, minivomitsuffixchance) and generateminivomit == True): + if ( + chance_roll(insanitylevel, minivomitsuffixchance) + and generateminivomit == True + ): completeprompt += " -minivomit-, " - - if(chance_roll(insanitylevel, artmovementchance) and generateartmovement == True): - completeprompt += "-artmovement-, " - - if(chance_roll(insanitylevel, lightingchance) and generatelighting == True): - completeprompt += "-lighting-, " + + if ( + chance_roll(insanitylevel, artmovementchance) + and generateartmovement == True + ): + completeprompt += "-artmovement-, " + + if chance_roll(insanitylevel, lightingchance) and generatelighting == True: + completeprompt += "-lighting-, " # determine wether we have a photo or not - if("photo" in completeprompt.lower()): + if "photo" in completeprompt.lower(): isphoto = 1 - - if(chance_roll(insanitylevel, photoadditionchance) and isphoto == 1 and generatephotoaddition == True): - completeprompt += random.choice(photoadditionlist) + ", " - - if(isphoto == 1 and generatecamera == True): - completeprompt += "-camera-, " - if(chance_roll(insanitylevel, lenschance) or isphoto == 1): - if(generatelens == True): + if ( + chance_roll(insanitylevel, photoadditionchance) + and isphoto == 1 + and generatephotoaddition == True + ): + completeprompt += random.choice(photoadditionlist) + ", " + + if isphoto == 1 and generatecamera == True: + completeprompt += "-camera-, " + + if chance_roll(insanitylevel, lenschance) or isphoto == 1: + if generatelens == True: completeprompt += "-lens-, " - if(chance_roll(insanitylevel, colorschemechance) and generatecolorscheme == True): + if ( + chance_roll(insanitylevel, colorschemechance) + and generatecolorscheme == True + ): completeprompt += "-colorscheme-, " # vomit some cool/wierd things into the prompt - if(chance_roll(insanitylevel, vomit1chance) and generatevomit == True): + if chance_roll(insanitylevel, vomit1chance) and generatevomit == True: completeprompt += "-vomit-, " - if(chance_roll(insanitylevel, vomit2chance)): + if chance_roll(insanitylevel, vomit2chance): completeprompt += "-vomit-, " # human specfic vomit - if(mainchooser == "humanoid" and chance_roll(insanitylevel, humanvomitchance) and generatehumanvomit == True): + if ( + mainchooser == "humanoid" + and chance_roll(insanitylevel, humanvomitchance) + and generatehumanvomit == True + ): completeprompt += "-humanvomit-, " - if(chance_roll(insanitylevel, humanvomitchance)): + if chance_roll(insanitylevel, humanvomitchance): completeprompt += "-humanvomit-, " - #adding a great work of art, like starry night has cool effects. But this should happen only very rarely. - if(chance_roll(insanitylevel, greatworkchance) and generategreatwork == True): + # adding a great work of art, like starry night has cool effects. But this should happen only very rarely. + if chance_roll(insanitylevel, greatworkchance) and generategreatwork == True: completeprompt += " in the style of -greatwork-, " - #adding a poemline. But this should happen only very rarely. - if(chance_roll(insanitylevel, poemlinechance) and generatepoemline == True): - completeprompt += " \"-poemline-\", " + # adding a poemline. But this should happen only very rarely. + if chance_roll(insanitylevel, poemlinechance) and generatepoemline == True: + completeprompt += ' "-poemline-", ' - #adding a songline. But this should happen only very rarely. - if(chance_roll(insanitylevel, songlinechance) and generatesongline == True): - completeprompt += " \"-songline-\", " + # adding a songline. But this should happen only very rarely. + if chance_roll(insanitylevel, songlinechance) and generatesongline == True: + completeprompt += ' "-songline-", ' # everyone loves the adding quality. The better models don't need this, but lets add it anyway - if((chance_roll(insanitylevel, quality1chance) or originalartistchoice == "greg mode") and generatequality == True): + if ( + chance_roll(insanitylevel, quality1chance) + or originalartistchoice == "greg mode" + ) and generatequality == True: completeprompt += "-quality-, " - if((chance_roll(insanitylevel, quality2chance) or originalartistchoice == "greg mode")): + if ( + chance_roll(insanitylevel, quality2chance) + or originalartistchoice == "greg mode" + ): completeprompt += "-quality-, " - - # start second part of art blaster here - if(artblastermode==True): + if artblastermode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(artistlist)): + if uncommon_dist(insanitylevel) and bool(artistlist): completeprompt += "-artist-, " - if(uncommon_dist(insanitylevel) and bool(artmovementlist)): + if uncommon_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(vomitlist)): + if unique_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(unique_dist(insanitylevel) and bool(imagetypelist)): + if unique_dist(insanitylevel) and bool(imagetypelist): completeprompt += "-imagetype-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): + if unique_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - step = step + 1 - - # start second part of unique art here - if(uniqueartmode==True): - step = 0 - end = random.randint(1, insanitylevel) + 1 - while step < end: - if(uncommon_dist(insanitylevel) and bool(artmovementlist)): - completeprompt += "-artmovement-, " - if(uncommon_dist(insanitylevel) and bool(colorschemelist)): - completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): - completeprompt += "-vomit-, " - if(rare_dist(insanitylevel) and bool(lightinglist)): - completeprompt += "-lighting-, " - if(unique_dist(insanitylevel) and bool(qualitylist)): - completeprompt += "-quality-, " - if(unique_dist(insanitylevel) and bool(artistlist)): - completeprompt += "-artist-, " - if(novel_dist(insanitylevel) and bool(greatworklist)): - completeprompt += "in style of -greatwork-, " - if(novel_dist(insanitylevel) and bool(poemlinelist)): - completeprompt += "\"-poemline-\", " - if(novel_dist(insanitylevel) and bool(songlinelist)): - completeprompt += "\"-songline-\", " - - step = step + 1 - - - # start second part of quality vomit here - if(qualityvomitmode==True): - step = 0 - end = random.randint(1, insanitylevel) + 1 - while step < end: - if(uncommon_dist(insanitylevel) and bool(vomitlist)): - completeprompt += "-vomit-, " - if(uncommon_dist(insanitylevel) and bool(qualitylist)): - completeprompt += "-quality-, " - if(unique_dist(insanitylevel) and bool(minivomitlist)): - completeprompt += "-minivomit-, " - if(unique_dist(insanitylevel) and bool(artmovementlist)) : - completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): - completeprompt += "-colorscheme-, " - step = step + 1 - - # start second part of mood color here - if(colorcannonmode == True): - step = 0 - end = random.randint(1, insanitylevel) + 1 - while step < end: - if(uncommon_dist(insanitylevel) and bool(moodlist)): - completeprompt += "-mood-, " - if(uncommon_dist(insanitylevel) and bool(colorschemelist)): - completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): - completeprompt += "-vomit-, " - if(unique_dist(insanitylevel) and bool(artmovementlist)): - completeprompt += "-artmovement-, " - if(unique_dist(insanitylevel) and bool(lightinglist)): - completeprompt += "-lighting-, " - step = step + 1 + step = step + 1 - - # start second part of photo fantasy here - if(photofantasymode == True): + # start second part of unique art here + if uniqueartmode == True: step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(uncommon_dist(insanitylevel) and bool(lightinglist)): - completeprompt += "-lighting-, " - if(uncommon_dist(insanitylevel) and bool(cameralist)): - completeprompt += "-camera-, " - if(rare_dist(insanitylevel) and bool(lenslist)): - completeprompt += "-lens-, " - if(unique_dist(insanitylevel) and bool(moodlist)): - completeprompt += "-mood-, " - if(unique_dist(insanitylevel) and bool(colorschemelist)): + if uncommon_dist(insanitylevel) and bool(artmovementlist): + completeprompt += "-artmovement-, " + if uncommon_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - step = step + 1 - + if rare_dist(insanitylevel) and bool(vomitlist): + completeprompt += "-vomit-, " + if rare_dist(insanitylevel) and bool(lightinglist): + completeprompt += "-lighting-, " + if unique_dist(insanitylevel) and bool(qualitylist): + completeprompt += "-quality-, " + if unique_dist(insanitylevel) and bool(artistlist): + completeprompt += "-artist-, " + if novel_dist(insanitylevel) and bool(greatworklist): + completeprompt += "in style of -greatwork-, " + if novel_dist(insanitylevel) and bool(poemlinelist): + completeprompt += '"-poemline-", ' + if novel_dist(insanitylevel) and bool(songlinelist): + completeprompt += '"-songline-", ' + + step = step + 1 + + # start second part of quality vomit here + if qualityvomitmode == True: + step = 0 + end = random.randint(1, insanitylevel) + 1 + while step < end: + if uncommon_dist(insanitylevel) and bool(vomitlist): + completeprompt += "-vomit-, " + if uncommon_dist(insanitylevel) and bool(qualitylist): + completeprompt += "-quality-, " + if unique_dist(insanitylevel) and bool(minivomitlist): + completeprompt += "-minivomit-, " + if unique_dist(insanitylevel) and bool(artmovementlist): + completeprompt += "-artmovement-, " + if unique_dist(insanitylevel) and bool(colorschemelist): + completeprompt += "-colorscheme-, " + step = step + 1 + + # start second part of mood color here + if colorcannonmode == True: + step = 0 + end = random.randint(1, insanitylevel) + 1 + while step < end: + if uncommon_dist(insanitylevel) and bool(moodlist): + completeprompt += "-mood-, " + if uncommon_dist(insanitylevel) and bool(colorschemelist): + completeprompt += "-colorscheme-, " + if rare_dist(insanitylevel) and bool(vomitlist): + completeprompt += "-vomit-, " + if unique_dist(insanitylevel) and bool(artmovementlist): + completeprompt += "-artmovement-, " + if unique_dist(insanitylevel) and bool(lightinglist): + completeprompt += "-lighting-, " + step = step + 1 + + # start second part of photo fantasy here + if photofantasymode == True: + step = 0 + end = random.randint(1, insanitylevel) + 1 + while step < end: + if uncommon_dist(insanitylevel) and bool(lightinglist): + completeprompt += "-lighting-, " + if uncommon_dist(insanitylevel) and bool(cameralist): + completeprompt += "-camera-, " + if rare_dist(insanitylevel) and bool(lenslist): + completeprompt += "-lens-, " + if unique_dist(insanitylevel) and bool(moodlist): + completeprompt += "-mood-, " + if unique_dist(insanitylevel) and bool(colorschemelist): + completeprompt += "-colorscheme-, " + step = step + 1 + # start second part of massive madness here - if(massivemadnessmode == True): + if massivemadnessmode == True: completeprompt += ", " step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if(rare_dist(insanitylevel) and bool(artistlist)): + if rare_dist(insanitylevel) and bool(artistlist): completeprompt += "-artist-, " - if(rare_dist(insanitylevel) and bool(descriptorlist)): + if rare_dist(insanitylevel) and bool(descriptorlist): completeprompt += "-descriptor-, " - if(rare_dist(insanitylevel) and bool(moodlist)): + if rare_dist(insanitylevel) and bool(moodlist): completeprompt += "-mood-, " - if(rare_dist(insanitylevel) and bool(colorschemelist)): + if rare_dist(insanitylevel) and bool(colorschemelist): completeprompt += "-colorscheme-, " - if(rare_dist(insanitylevel) and bool(vomitlist)): + if rare_dist(insanitylevel) and bool(vomitlist): completeprompt += "-vomit-, " - if(rare_dist(insanitylevel) and bool(artmovementlist)): + if rare_dist(insanitylevel) and bool(artmovementlist): completeprompt += "-artmovement-, " - if(rare_dist(insanitylevel) and bool(lightinglist)): + if rare_dist(insanitylevel) and bool(lightinglist): completeprompt += "-lighting-, " - if(rare_dist(insanitylevel) and bool(minilocationadditionslist)): + if rare_dist(insanitylevel) and bool(minilocationadditionslist): completeprompt += "-minilocationaddition-, " - if(rare_dist(insanitylevel) and bool(materiallist)): + if rare_dist(insanitylevel) and bool(materiallist): completeprompt += "-material-, " - if(rare_dist(insanitylevel) and bool(conceptsuffixlist)): + if rare_dist(insanitylevel) and bool(conceptsuffixlist): completeprompt += "-conceptsuffix-, " - if(rare_dist(insanitylevel) and bool(qualitylist)): + if rare_dist(insanitylevel) and bool(qualitylist): completeprompt += "-quality-, " - if(rare_dist(insanitylevel) and bool(cameralist)): + if rare_dist(insanitylevel) and bool(cameralist): completeprompt += "-camera-, " - step = step + 1 + step = step + 1 # start styles mode here - if(stylesmode == True): + if stylesmode == True: completeprompt += chosenstylesuffix - # custom style list - if(chance_roll(insanitylevel, customstyle1chance) and generatestyle == True): + if chance_roll(insanitylevel, customstyle1chance) and generatestyle == True: completeprompt += "-styletilora-, " - if(chance_roll(insanitylevel, customstyle2chance)): + if chance_roll(insanitylevel, customstyle2chance): completeprompt += "-styletilora-, " - # custom suffix list for i in range(custominputsuffixrepeats): - if(chance_roll(insanitylevel, custominputsuffixchance) and generatecustominputsuffix == True): + if ( + chance_roll(insanitylevel, custominputsuffixchance) + and generatecustominputsuffix == True + ): completeprompt += random.choice(custominputsuffixlist) + ", " - - if artistmode in ["enhancing"]: - completeprompt += "::" + str(random.randint(1,17)) + "] " + completeprompt += "::" + str(random.randint(1, 17)) + "] " - - - if(artists != "none" and artistsplacement == "back" and generateartist == True): + if artists != "none" and artistsplacement == "back" and generateartist == True: completeprompt += ", " doartistnormal = True - if(artists == "greg mode"): + if artists == "greg mode": artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode- ," doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif(originalartistchoice == "all" and random.randint(0,3) == 0): - if(mainchooser in ["humanoid", "animal"]): + elif originalartistchoice == "all" and random.randint(0, 3) == 0: + if mainchooser in ["humanoid", "animal"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(mainchooser in ["landscape"]): + elif mainchooser in ["landscape"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - elif(subjectchooser in ["building"]): + elif subjectchooser in ["building"]: artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + completeprompt += ( + random.choice(artistbylist) + + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " + ) doartistnormal = False - - if(doartistnormal): + + if doartistnormal: # take 1-3 artists, weighted to 1-2 step = random.randint(0, 1) minstep = step end = random.randint(1, insanitylevel3) - - - # determine artist mode: # normal # hybrid | @@ -2484,34 +3477,37 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # adding at step x a:X # stopping at step x ::X - - modeselector = random.randint(0,10) + modeselector = random.randint(0, 10) if modeselector < 4 and end - step >= 2: artistmodeslist = ["hybrid", "stopping", "adding", "switching"] artistmode = artistmodeslist[modeselector] - if(advancedprompting == False): + if advancedprompting == False: artistmode = "normal" - if artistmode in ["hybrid","switching"] and end - step == 1: + if artistmode in ["hybrid", "switching"] and end - step == 1: artistmode = "normal" # if there are not enough artists in the list, then just go normal - if(len(artistlist) < 3): + if len(artistlist) < 3: artistmode = "normal" - - if artistmode in ["hybrid", "stopping", "adding","switching"]: + + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += " [" - - while step < end: - if(normal_dist(insanitylevel)): + + while step < end: + if normal_dist(insanitylevel): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if(step == minstep): + # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if step == minstep: # sometimes do this - if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): - if(artiststyleselectormode == "normal"): + if ( + giventypeofimage == "" + and imagetype == "all" + and random.randint(0, 1) == 0 + ): + if artiststyleselectormode == "normal": completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -2519,469 +3515,798 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" - + completeprompt += ( + ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" + ) + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if artistmode not in ["hybrid", "switching"]and not end - step == 1: + + if ( + artistmode not in ["hybrid", "switching"] + and not end - step == 1 + ): completeprompt += "," - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1,19)) - - if artistmode in ["switching","adding"]: - completeprompt += ":" + str(random.randint(1,18)) - if artistmode in ["hybrid", "stopping","adding", "switching"]: + completeprompt += str(random.randint(1, 19)) + + if artistmode in ["switching", "adding"]: + completeprompt += ":" + str(random.randint(1, 18)) + if artistmode in ["hybrid", "stopping", "adding", "switching"]: completeprompt += "] " # end of the artist stuff - - - completeprompt += ", " completeprompt += suffixprompt # and then up the compounding stuff compoundcounter += 1 - + # Here comes all the seperator stuff for prompt compounding - if(compoundcounter < promptstocompound): - if(seperator == "comma"): + if compoundcounter < promptstocompound: + if seperator == "comma": completeprompt += " \n , " else: completeprompt += " \n " + seperator + " " - - - - - #end of the while loop, now clean up the prompt - - - - + # end of the while loop, now clean up the prompt # In front and the back? completeprompt = parse_custom_functions(completeprompt, insanitylevel) - + # Sometimes change he/she to the actual subject # Doesnt work if someone puts in a manual subject - if(mainchooser == "humanoid" and givensubject == "" and subjectchooser != "manwomanmultiple"): - samehumanreplacementlist = ["-heshe-","-heshe-","-heshe-","-heshe-","-heshe-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-"] + if ( + mainchooser == "humanoid" + and givensubject == "" + and subjectchooser != "manwomanmultiple" + ): + samehumanreplacementlist = [ + "-heshe-", + "-heshe-", + "-heshe-", + "-heshe-", + "-heshe-", + "-samehumansubject-", + "-samehumansubject-", + "-samehumansubject-", + "-samehumansubject-", + "-samehumansubject-", + ] random.shuffle(samehumanreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-heshe-") + 1): - if "".join(completeprompt_list[i:i+len("-heshe-")]) == "-heshe-": + if "".join(completeprompt_list[i : i + len("-heshe-")]) == "-heshe-": # Replace -heshe- with a value from the shuffled list replacement = samehumanreplacementlist.pop() - completeprompt_list[i:i+len("-heshe-")] = replacement + completeprompt_list[i : i + len("-heshe-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) - + # Sometimes change he/she to the actual subject - if(mainchooser in ["animal", "object"] and givensubject == ""): - sameobjectreplacementlist = ["-heshe-","-heshe-","-heshe-","-heshe-","-heshe-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-"] + if mainchooser in ["animal", "object"] and givensubject == "": + sameobjectreplacementlist = [ + "-heshe-", + "-heshe-", + "-heshe-", + "-heshe-", + "-heshe-", + "-sameothersubject-", + "-sameothersubject-", + "-sameothersubject-", + "-sameothersubject-", + "-sameothersubject-", + ] random.shuffle(sameobjectreplacementlist) # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-heshe-") + 1): - if "".join(completeprompt_list[i:i+len("-heshe-")]) == "-heshe-": + if "".join(completeprompt_list[i : i + len("-heshe-")]) == "-heshe-": # Replace -heshe- with a value from the shuffled list replacement = sameobjectreplacementlist.pop() - completeprompt_list[i:i+len("-heshe-")] = replacement + completeprompt_list[i : i + len("-heshe-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) # hair descriptor - if(rare_dist(insanitylevel)): # Use base hair descriptor, until we are not. + if rare_dist(insanitylevel): # Use base hair descriptor, until we are not. completeprompt = completeprompt.replace("-hairdescriptor-", "-descriptor-") - + # human descriptor - if(rare_dist(insanitylevel)): # Use base human descriptor, until we are not. + if rare_dist(insanitylevel): # Use base human descriptor, until we are not. completeprompt = completeprompt.replace("-humandescriptor-", "-descriptor-") - + # location descriptor - if(rare_dist(insanitylevel)): # Use base location descriptor, until we are not. + if rare_dist(insanitylevel): # Use base location descriptor, until we are not. completeprompt = completeprompt.replace("-locationdescriptor-", "-descriptor-") - + # animeal descriptor - if(rare_dist(insanitylevel)): # Use base animal descriptor, until we are not. + if rare_dist(insanitylevel): # Use base animal descriptor, until we are not. completeprompt = completeprompt.replace("-animaldescriptor-", "-descriptor-") - # sometimes, culture becomes traditional! - if(unique_dist(insanitylevel)): + if unique_dist(insanitylevel): completeprompt = completeprompt.replace("-culture-", "traditional -culture-") - # first some manual stuff for outfit - if(unique_dist(insanitylevel)): # sometimes, its just nice to have descriptor and a normal "outfit". We use mini outfits for this! - completeprompt = completeprompt.replace("-outfit-", "-minioutfit-",1) - if(rare_dist(insanitylevel)): # Use base outfit descriptor, until we are not. + if unique_dist( + insanitylevel + ): # sometimes, its just nice to have descriptor and a normal "outfit". We use mini outfits for this! + completeprompt = completeprompt.replace("-outfit-", "-minioutfit-", 1) + if rare_dist(insanitylevel): # Use base outfit descriptor, until we are not. completeprompt = completeprompt.replace("-outfitdescriptor-", "-descriptor-") - if(overrideoutfit != ""): + if overrideoutfit != "": completeprompt = completeprompt.replace("-sameoutfit-", overrideoutfit) - completeprompt = completeprompt.replace("-outfit-", overrideoutfit,1) - completeprompt = completeprompt.replace("-minioutfit-", overrideoutfit,1) + completeprompt = completeprompt.replace("-outfit-", overrideoutfit, 1) + completeprompt = completeprompt.replace("-minioutfit-", overrideoutfit, 1) completeprompt = completeprompt.replace("-overrideoutfit-", overrideoutfit) - if(givensubject != ""): + if givensubject != "": completeprompt = completeprompt.replace("-samehumansubject-", givensubject) completeprompt = completeprompt.replace("-sameothersubject-", givensubject) - + # If we don't have an override outfit, then remove this part completeprompt = completeprompt.replace("-overrideoutfit-", "") # sometimes replace one descriptor with a artmovement, only on high insanitylevels - if(insanitylevel > 7 and unique_dist(insanitylevel)): - completeprompt = completeprompt.replace("-descriptor-", "-artmovement-",1) + if insanitylevel > 7 and unique_dist(insanitylevel): + completeprompt = completeprompt.replace("-descriptor-", "-artmovement-", 1) # On low insanity levels (lower than 5) ,a chance refer to the basic bitch list on some occasions - if(random.randint(0,insanitylevel) == 0 and insanitylevel < 5): - completeprompt = completeprompt.replace("-locationdescriptor-", "-basicbitchdescriptor-") - completeprompt = completeprompt.replace("-humandescriptor-", "-basicbitchdescriptor-") - completeprompt = completeprompt.replace("-outfitdescriptor-", "-basicbitchdescriptor-") - completeprompt = completeprompt.replace("-descriptor-", "-basicbitchdescriptor-") - completeprompt = completeprompt.replace("-animaldescriptor-", "-basicbitchdescriptor-") + if random.randint(0, insanitylevel) == 0 and insanitylevel < 5: + completeprompt = completeprompt.replace( + "-locationdescriptor-", "-basicbitchdescriptor-" + ) + completeprompt = completeprompt.replace( + "-humandescriptor-", "-basicbitchdescriptor-" + ) + completeprompt = completeprompt.replace( + "-outfitdescriptor-", "-basicbitchdescriptor-" + ) + completeprompt = completeprompt.replace( + "-descriptor-", "-basicbitchdescriptor-" + ) + completeprompt = completeprompt.replace( + "-animaldescriptor-", "-basicbitchdescriptor-" + ) # we now have color combinations, which are stronger than just color. So lets change them while we are at it. - if(random.randint(0,max(0, insanitylevel - 2)) <= 0): - completeprompt = completeprompt.replace("-color- and -color-", "-colorcombination-") # any color and color becomes a color combination + if random.randint(0, max(0, insanitylevel - 2)) <= 0: + completeprompt = completeprompt.replace( + "-color- and -color-", "-colorcombination-" + ) # any color and color becomes a color combination - colorreplacementlist = ["-color-","-color-","-color-","-colorcombination-","-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-"] + colorreplacementlist = [ + "-color-", + "-color-", + "-color-", + "-colorcombination-", + "-colorcombination-", + "-colorcombination-", + "-colorcombination-", + "-colorcombination-", + "-colorcombination-", + "-colorcombination-", + ] random.shuffle(colorreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-color-") + 1): - if "".join(completeprompt_list[i:i+len("-color-")]) == "-color-": + if "".join(completeprompt_list[i : i + len("-color-")]) == "-color-": # Replace -heshe- with a value from the shuffled list replacement = colorreplacementlist.pop() - completeprompt_list[i:i+len("-color-")] = replacement + completeprompt_list[i : i + len("-color-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) + # we now have material combinations, which are stronger than just one material. So lets change them while we are at it. + if random.randint(0, max(0, insanitylevel - 4)) <= 0: + completeprompt = completeprompt.replace( + "-material- and -material-", "-materialcombination-" + ) # any color and color becomes a color combination - # we now have material combinations, which are stronger than just one material. So lets change them while we are at it. - if(random.randint(0,max(0, insanitylevel - 4)) <= 0): - completeprompt = completeprompt.replace("-material- and -material-", "-materialcombination-") # any color and color becomes a color combination - - materialreplacementlist = ["-material-","-material-","-material-","-materialcombination-","-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-"] + materialreplacementlist = [ + "-material-", + "-material-", + "-material-", + "-materialcombination-", + "-materialcombination-", + "-materialcombination-", + "-materialcombination-", + "-materialcombination-", + "-materialcombination-", + "-materialcombination-", + ] random.shuffle(materialreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-material-") + 1): - if "".join(completeprompt_list[i:i+len("-material-")]) == "-material-": + if "".join(completeprompt_list[i : i + len("-material-")]) == "-material-": # Replace -heshe- with a value from the shuffled list replacement = materialreplacementlist.pop() - completeprompt_list[i:i+len("-material-")] = replacement + completeprompt_list[i : i + len("-material-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) - - - # 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 or - "-conceptprefix-" in completeprompt or - "-descriptor-" in completeprompt or - "-food-" in completeprompt or - "-haircolor-" in completeprompt or - "-hairstyle-" in completeprompt or - "-job-" in completeprompt or - "-culture-" in completeprompt or - "-accessory-" in completeprompt or - "-humanoid-" in completeprompt or - "-manwoman-" in completeprompt or - "-human-" in completeprompt or - "-colorscheme-" in completeprompt or - "-mood-" in completeprompt or - "-genderdescription-" in completeprompt or - "-artmovement-" in completeprompt or - "-malefemale-" in completeprompt or - "-objecttotal-" in completeprompt or - "-outfitprinttotal-" in completeprompt or - "-bodytype-" in completeprompt or - "-minilocation-" in completeprompt or - "-minilocationaddition-" in completeprompt or - "-pose-" in completeprompt or - "-season-" in completeprompt or - "-minioutfit-" in completeprompt or - "-elaborateoutfit-" in completeprompt or - "-minivomit-" in completeprompt or - "-vomit-" in completeprompt or - "-rpgclass-" in completeprompt or - "-subjectfromfile-" in completeprompt or - "-outfitfromfile-" in completeprompt or - "-brand-" in completeprompt or - "-space-" in completeprompt or - "-artist-" in completeprompt or - "-imagetype-" in completeprompt or - "-othertype-" in completeprompt or - "-quality-" in completeprompt or - "-lighting-" in completeprompt or - "-camera-" in completeprompt or - "-lens-" in completeprompt or - "-imagetypequality-" in completeprompt or - "-poemline-" in completeprompt or - "-songline-" in completeprompt or - "-greatwork-" in completeprompt or - "-fantasyartist-" in completeprompt or - "-popularartist-" in completeprompt or - "-romanticismartist-" in completeprompt or - "-photographyartist-" in completeprompt or - "-emoji-" in completeprompt or - "-timeperiod-" in completeprompt or - "-shotsize-" in completeprompt or - "-musicgenre-" in completeprompt or - "-animaladdition-" in completeprompt or - "-addontolocationinside-" in completeprompt or - "-addontolocation-" in completeprompt or - "-objectaddition-" in completeprompt or - "-humanaddition-" in completeprompt or - "-overalladdition-" in completeprompt or - "-focus-" in completeprompt or - "-direction-" in completeprompt or - "-styletilora-" in completeprompt or - "-manwomanrelation-" in completeprompt or - "-manwomanmultiple-" in completeprompt or - "-waterlocation-" in completeprompt or - "-container-" in completeprompt or - "-firstname-" in completeprompt or - "-flora-" in completeprompt or - "-print-" in completeprompt or - "-miniactivity-" in completeprompt or - "-pattern-" in completeprompt or - "-animalsuffixaddition-" in completeprompt or - "-chair-" in completeprompt or - "-cardname-" in completeprompt or - "-covering-" in completeprompt or - "-heshe-" in completeprompt or - "-hisher-" in completeprompt or - "-himher-" in completeprompt or - "-outfitdescriptor-" in completeprompt or - "-hairdescriptor-" in completeprompt or - "-hairvomit-" in completeprompt or - "-humandescriptor-" in completeprompt or - "-facepart-" in completeprompt or - "-buildfacepart-" in completeprompt or - "-outfitvomit-" in completeprompt or - "-locationdescriptor-" in completeprompt or - "-basicbitchdescriptor-" in completeprompt or - "-animaldescriptor-" in completeprompt or - "-humanexpression-" in completeprompt or - "-humanvomit-" in completeprompt or - "-eyecolor-" in completeprompt or - "-fashiondesigner-" in completeprompt or - "-colorcombination-" in completeprompt or - "-materialcombination-" in completeprompt or - "-oppositefictional-" in completeprompt or - "-oppositenonfictional-" in completeprompt or - "-photoaddition-" in completeprompt or - "-age-" in completeprompt or - "-agecalculator-" in completeprompt or - "-gregmode-" in completeprompt or - "-portraitartist-" in completeprompt or - "-characterartist-" in completeprompt or - "-landscapeartist-" in completeprompt or - "-scifiartist-" in completeprompt or - "-graphicdesignartist-" in completeprompt or - "-digitalartist-" in completeprompt or - "-architectartist-" in completeprompt or - "-cinemaartist-" in completeprompt or - "-element-" in completeprompt or - "-setting-" in completeprompt or - "-charactertype-" in completeprompt or - "-objectstohold-" in completeprompt or - "-episodetitle-" in completeprompt): - allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-","-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-fantasyartist-", "-popularartist-", "-romanticismartist-", "-photographyartist-", "-emoji-", "-timeperiod-", "-shotsize-", "-musicgenre-", "-animaladdition-", "-addontolocationinside-", "-addontolocation-", "-objectaddition-", "-humanaddition-", "-overalladdition-", "-focus-", "-direction-", "-styletilora-", "-manwomanrelation-", "-waterlocation-", "-container-", "-firstname-", "-flora-", "-print-", "-miniactivity-", "-pattern-", "-animalsuffixaddition-", "-chair-", "-cardname-", "-covering-", "-heshe-", "-hisher-", "-himher-", "-outfitdescriptor-", "-hairdescriptor-", "-hairvomit-", "-humandescriptor-", "-manwomanmultiple-", "-facepart-", "-buildfacepart-", "-outfitvomit-", "-locationdescriptor-", "-basicbitchdescriptor-", "-animaldescriptor-", "-humanexpression-", "-humanvomit-", "-eyecolor-", "-fashiondesigner-", "-colorcombination-", "-materialcombination-", "-oppositefictional-", "-oppositenonfictional-", "-photoaddition-", "-age-", "-agecalculator-", "-gregmode-" - ,"-portraitartist-", "-characterartist-" , "-landscapeartist-", "-scifiartist-", "-graphicdesignartist-", "-digitalartist-", "-architectartist-", "-cinemaartist-", "-setting-", "-charactertype-", "-objectstohold-", "-episodetitle-"] - allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, customoutfitslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist, fantasyartistlist, popularartistlist, romanticismartistlist, photographyartistlist, emojilist, timeperiodlist, shotsizelist, musicgenrelist, animaladditionlist, addontolocationinsidelist, addontolocationlist, objectadditionslist, humanadditionlist, overalladditionlist, focuslist, directionlist, stylestiloralist, manwomanrelationlist, waterlocationlist, containerlist, firstnamelist, floralist, printlist, miniactivitylist, patternlist, animalsuffixadditionlist, chairlist, cardnamelist, coveringlist, heshelist, hisherlist, himherlist, outfitdescriptorlist, hairdescriptorlist, hairvomitlist, humandescriptorlist, manwomanmultiplelist, facepartlist, buildfacepartlist, outfitvomitlist, locationdescriptorlist, basicbitchdescriptorlist, animaldescriptorlist, humanexpressionlist, humanvomitlist, eyecolorlist, fashiondesignerlist, colorcombinationlist, materialcombinationlist, oppositefictionallist, oppositenonfictionallist, photoadditionlist, agelist, agecalculatorlist, gregmodelist - , portraitartistlist, characterartistlist, landscapeartistlist, scifiartistlist, graphicdesignartistlist, digitalartistlist, architectartistlist, cinemaartistlist, settinglist, charactertypelist, objectstoholdlist, episodetitlelist] - - allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-", "-outfitprinttotal-", "-element-"] - allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist, outfitprinttotallist, elementlist] - - + "-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 + or "-conceptprefix-" in completeprompt + or "-descriptor-" in completeprompt + or "-food-" in completeprompt + or "-haircolor-" in completeprompt + or "-hairstyle-" in completeprompt + or "-job-" in completeprompt + or "-culture-" in completeprompt + or "-accessory-" in completeprompt + or "-humanoid-" in completeprompt + or "-manwoman-" in completeprompt + or "-human-" in completeprompt + or "-colorscheme-" in completeprompt + or "-mood-" in completeprompt + or "-genderdescription-" in completeprompt + or "-artmovement-" in completeprompt + or "-malefemale-" in completeprompt + or "-objecttotal-" in completeprompt + or "-outfitprinttotal-" in completeprompt + or "-bodytype-" in completeprompt + or "-minilocation-" in completeprompt + or "-minilocationaddition-" in completeprompt + or "-pose-" in completeprompt + or "-season-" in completeprompt + or "-minioutfit-" in completeprompt + or "-elaborateoutfit-" in completeprompt + or "-minivomit-" in completeprompt + or "-vomit-" in completeprompt + or "-rpgclass-" in completeprompt + or "-subjectfromfile-" in completeprompt + or "-outfitfromfile-" in completeprompt + or "-brand-" in completeprompt + or "-space-" in completeprompt + or "-artist-" in completeprompt + or "-imagetype-" in completeprompt + or "-othertype-" in completeprompt + or "-quality-" in completeprompt + or "-lighting-" in completeprompt + or "-camera-" in completeprompt + or "-lens-" in completeprompt + or "-imagetypequality-" in completeprompt + or "-poemline-" in completeprompt + or "-songline-" in completeprompt + or "-greatwork-" in completeprompt + or "-fantasyartist-" in completeprompt + or "-popularartist-" in completeprompt + or "-romanticismartist-" in completeprompt + or "-photographyartist-" in completeprompt + or "-emoji-" in completeprompt + or "-timeperiod-" in completeprompt + or "-shotsize-" in completeprompt + or "-musicgenre-" in completeprompt + or "-animaladdition-" in completeprompt + or "-addontolocationinside-" in completeprompt + or "-addontolocation-" in completeprompt + or "-objectaddition-" in completeprompt + or "-humanaddition-" in completeprompt + or "-overalladdition-" in completeprompt + or "-focus-" in completeprompt + or "-direction-" in completeprompt + or "-styletilora-" in completeprompt + or "-manwomanrelation-" in completeprompt + or "-manwomanmultiple-" in completeprompt + or "-waterlocation-" in completeprompt + or "-container-" in completeprompt + or "-firstname-" in completeprompt + or "-flora-" in completeprompt + or "-print-" in completeprompt + or "-miniactivity-" in completeprompt + or "-pattern-" in completeprompt + or "-animalsuffixaddition-" in completeprompt + or "-chair-" in completeprompt + or "-cardname-" in completeprompt + or "-covering-" in completeprompt + or "-heshe-" in completeprompt + or "-hisher-" in completeprompt + or "-himher-" in completeprompt + or "-outfitdescriptor-" in completeprompt + or "-hairdescriptor-" in completeprompt + or "-hairvomit-" in completeprompt + or "-humandescriptor-" in completeprompt + or "-facepart-" in completeprompt + or "-buildfacepart-" in completeprompt + or "-outfitvomit-" in completeprompt + or "-locationdescriptor-" in completeprompt + or "-basicbitchdescriptor-" in completeprompt + or "-animaldescriptor-" in completeprompt + or "-humanexpression-" in completeprompt + or "-humanvomit-" in completeprompt + or "-eyecolor-" in completeprompt + or "-fashiondesigner-" in completeprompt + or "-colorcombination-" in completeprompt + or "-materialcombination-" in completeprompt + or "-oppositefictional-" in completeprompt + or "-oppositenonfictional-" in completeprompt + or "-photoaddition-" in completeprompt + or "-age-" in completeprompt + or "-agecalculator-" in completeprompt + or "-gregmode-" in completeprompt + or "-portraitartist-" in completeprompt + or "-characterartist-" in completeprompt + or "-landscapeartist-" in completeprompt + or "-scifiartist-" in completeprompt + or "-graphicdesignartist-" in completeprompt + or "-digitalartist-" in completeprompt + or "-architectartist-" in completeprompt + or "-cinemaartist-" in completeprompt + or "-element-" in completeprompt + or "-setting-" in completeprompt + or "-charactertype-" in completeprompt + or "-objectstohold-" in completeprompt + or "-episodetitle-" in completeprompt + ): + allwildcardslistnohybrid = [ + "-color-", + "-object-", + "-animal-", + "-fictional-", + "-nonfictional-", + "-building-", + "-vehicle-", + "-location-", + "-conceptprefix-", + "-food-", + "-haircolor-", + "-hairstyle-", + "-job-", + "-accessory-", + "-humanoid-", + "-manwoman-", + "-human-", + "-colorscheme-", + "-mood-", + "-genderdescription-", + "-artmovement-", + "-malefemale-", + "-bodytype-", + "-minilocation-", + "-minilocationaddition-", + "-pose-", + "-season-", + "-minioutfit-", + "-elaborateoutfit-", + "-minivomit-", + "-vomit-", + "-rpgclass-", + "-subjectfromfile-", + "-subjectfromfile-", + "-brand-", + "-space-", + "-artist-", + "-imagetype-", + "-othertype-", + "-quality-", + "-lighting-", + "-camera-", + "-lens-", + "-imagetypequality-", + "-poemline-", + "-songline-", + "-greatwork-", + "-fantasyartist-", + "-popularartist-", + "-romanticismartist-", + "-photographyartist-", + "-emoji-", + "-timeperiod-", + "-shotsize-", + "-musicgenre-", + "-animaladdition-", + "-addontolocationinside-", + "-addontolocation-", + "-objectaddition-", + "-humanaddition-", + "-overalladdition-", + "-focus-", + "-direction-", + "-styletilora-", + "-manwomanrelation-", + "-waterlocation-", + "-container-", + "-firstname-", + "-flora-", + "-print-", + "-miniactivity-", + "-pattern-", + "-animalsuffixaddition-", + "-chair-", + "-cardname-", + "-covering-", + "-heshe-", + "-hisher-", + "-himher-", + "-outfitdescriptor-", + "-hairdescriptor-", + "-hairvomit-", + "-humandescriptor-", + "-manwomanmultiple-", + "-facepart-", + "-buildfacepart-", + "-outfitvomit-", + "-locationdescriptor-", + "-basicbitchdescriptor-", + "-animaldescriptor-", + "-humanexpression-", + "-humanvomit-", + "-eyecolor-", + "-fashiondesigner-", + "-colorcombination-", + "-materialcombination-", + "-oppositefictional-", + "-oppositenonfictional-", + "-photoaddition-", + "-age-", + "-agecalculator-", + "-gregmode-", + "-portraitartist-", + "-characterartist-", + "-landscapeartist-", + "-scifiartist-", + "-graphicdesignartist-", + "-digitalartist-", + "-architectartist-", + "-cinemaartist-", + "-setting-", + "-charactertype-", + "-objectstohold-", + "-episodetitle-", + ] + allwildcardslistnohybridlists = [ + colorlist, + objectlist, + animallist, + fictionallist, + nonfictionallist, + buildinglist, + vehiclelist, + locationlist, + conceptprefixlist, + foodlist, + haircolorlist, + hairstylelist, + joblist, + accessorielist, + humanoidlist, + manwomanlist, + humanlist, + colorschemelist, + moodlist, + genderdescriptionlist, + artmovementlist, + malefemalelist, + bodytypelist, + minilocationlist, + minilocationadditionslist, + poselist, + seasonlist, + minioutfitlist, + elaborateoutfitlist, + minivomitlist, + vomitlist, + rpgclasslist, + customsubjectslist, + customoutfitslist, + brandlist, + spacelist, + artistlist, + imagetypelist, + othertypelist, + qualitylist, + lightinglist, + cameralist, + lenslist, + imagetypequalitylist, + poemlinelist, + songlinelist, + greatworklist, + fantasyartistlist, + popularartistlist, + romanticismartistlist, + photographyartistlist, + emojilist, + timeperiodlist, + shotsizelist, + musicgenrelist, + animaladditionlist, + addontolocationinsidelist, + addontolocationlist, + objectadditionslist, + humanadditionlist, + overalladditionlist, + focuslist, + directionlist, + stylestiloralist, + manwomanrelationlist, + waterlocationlist, + containerlist, + firstnamelist, + floralist, + printlist, + miniactivitylist, + patternlist, + animalsuffixadditionlist, + chairlist, + cardnamelist, + coveringlist, + heshelist, + hisherlist, + himherlist, + outfitdescriptorlist, + hairdescriptorlist, + hairvomitlist, + humandescriptorlist, + manwomanmultiplelist, + facepartlist, + buildfacepartlist, + outfitvomitlist, + locationdescriptorlist, + basicbitchdescriptorlist, + animaldescriptorlist, + humanexpressionlist, + humanvomitlist, + eyecolorlist, + fashiondesignerlist, + colorcombinationlist, + materialcombinationlist, + oppositefictionallist, + oppositenonfictionallist, + photoadditionlist, + agelist, + agecalculatorlist, + gregmodelist, + portraitartistlist, + characterartistlist, + landscapeartistlist, + scifiartistlist, + graphicdesignartistlist, + digitalartistlist, + architectartistlist, + cinemaartistlist, + settinglist, + charactertypelist, + objectstoholdlist, + episodetitlelist, + ] + + allwildcardslistwithhybrid = [ + "-material-", + "-descriptor-", + "-outfit-", + "-conceptsuffix-", + "-culture-", + "-objecttotal-", + "-outfitprinttotal-", + "-element-", + ] + allwildcardslistwithhybridlists = [ + materiallist, + descriptorlist, + outfitlist, + conceptsuffixlist, + culturelist, + objecttotallist, + outfitprinttotallist, + elementlist, + ] + # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) for wildcard in allwildcardslistnohybrid: - attachedlist = allwildcardslistnohybridlists[allwildcardslistnohybrid.index(wildcard)] - completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,False, advancedprompting, artiststyleselector) + attachedlist = allwildcardslistnohybridlists[ + allwildcardslistnohybrid.index(wildcard) + ] + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + wildcard, + attachedlist, + False, + advancedprompting, + artiststyleselector, + ) - - for wildcard in allwildcardslistwithhybrid: - attachedlist = allwildcardslistwithhybridlists[allwildcardslistwithhybrid.index(wildcard)] - completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,True, advancedprompting, artiststyleselector) + attachedlist = allwildcardslistwithhybridlists[ + allwildcardslistwithhybrid.index(wildcard) + ] + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + wildcard, + attachedlist, + True, + advancedprompting, + artiststyleselector, + ) - - # prompt strenght stuff # if the given subject already is formed like this ( :1.x) # then just ignore this - + matches = [] - if(givensubject != ""): - pattern = r'\(\w+:\d+\.\d+\)' + if givensubject != "": + pattern = r"\(\w+:\d+\.\d+\)" matches = re.findall(pattern, givensubject) - - if(len(completeprompt) > 325 and matches == []): - if(len(completeprompt) < 375): - strenght = "1.1" - elif(len(completeprompt) < 450): - strenght = "1.2" + if len(completeprompt) > 325 and matches == []: + if len(completeprompt) < 375: + strenght = "1.1" + elif len(completeprompt) < 450: + strenght = "1.2" else: - strenght = "1.3" - completeprompt = completeprompt.replace("-objectstrengthstart-","(") - completeprompt = completeprompt.replace("-objectstrengthend-",":" + strenght + ")") + strenght = "1.3" + completeprompt = completeprompt.replace("-objectstrengthstart-", "(") + completeprompt = completeprompt.replace( + "-objectstrengthend-", ":" + strenght + ")" + ) else: - completeprompt = completeprompt.replace("-objectstrengthstart-","") - completeprompt = completeprompt.replace("-objectstrengthend-","") + completeprompt = completeprompt.replace("-objectstrengthstart-", "") + completeprompt = completeprompt.replace("-objectstrengthend-", "") - # Now, we are going to parse any custom functions we have build in # this is OR() # OR() - + # OR(foo;bar;bla) --> randomly take foo, bar or bla # OR(foo;bar;bla;uncommon) --> Take foo, unless it hits uncommon roll. Then take bar or bla # OR(;foo) --> empty or foo # OR(;foo;uncommon) --> empty unless it hits uncommon roll. Then take foo # OR(;foo;bar;uncommon) --> empty unless it hits uncommon roll. Then take foo or bar - - + completeprompt = parse_custom_functions(completeprompt, insanitylevel) - + # clean it up completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) - # Split it up for support for prompt_g (subject) and prompt_l (style) - if("@" in completeprompt and prompt_g_and_l == True): - promptlist = completeprompt.split("@") - prompt_g = cleanup(promptlist[1], advancedprompting, insanitylevel) - prompt_l = cleanup((promptlist[0] + ", " + promptlist[2]).replace("of a",""), advancedprompting, insanitylevel) - elif(prompt_g_and_l == True): - prompt_g = completeprompt - prompt_l = completeprompt - - completeprompt = completeprompt.replace(" @ ", " ") - completeprompt = completeprompt.replace("@ ", " ") - completeprompt = completeprompt.replace(" @", " ") - completeprompt = completeprompt.replace("@", " ") - completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) - - #just for me, some fun with posting fake dev messages (ala old sim games) - if(random.randint(1, 50)==1): + # just for me, some fun with posting fake dev messages (ala old sim games) + if random.randint(1, 50) == 1: print("") print(random.choice(devmessagelist)) print("") print(completeprompt) - if(prompt_g_and_l == False): - return completeprompt - else: - return completeprompt, prompt_g, prompt_l + return completeprompt # function that takes an existing prompt and tries to create a variant out of it -def createpromptvariant(prompt = "", insanitylevel = 5, antivalues = "" , gender = "all", artists = "all", advancedprompting = True): +def createpromptvariant( + prompt="", + insanitylevel=5, + antivalues="", + gender="all", + artists="all", + advancedprompting=True, +): # first load the lists, all copied from above (can that be done better?) # do we want to use the same settings or keep it open?? # first build up a complete anti list. Those values are removing during list building # this uses the antivalues string AND the antilist.csv emptylist = [] - antilist = csv_to_list("antilist",emptylist , "./userfiles/",1) + antilist = csv_to_list("antilist", emptylist, "./userfiles/", 1) antivaluelist = antivalues.split(",") antilist += antivaluelist # build all lists here - colorlist = csv_to_list("colors",antilist) - animallist = csv_to_list("animals",antilist) - materiallist = csv_to_list("materials",antilist) - objectlist = csv_to_list("objects",antilist) - fictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=gender) - nonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=gender) - conceptsuffixlist = csv_to_list("concept_suffix",antilist) - buildinglist = csv_to_list("buildings",antilist) - vehiclelist = csv_to_list("vehicles",antilist) - outfitlist = csv_to_list("outfits",antilist) - locationlist = csv_to_list("locations",antilist) + colorlist = csv_to_list("colors", antilist) + animallist = csv_to_list("animals", antilist) + materiallist = csv_to_list("materials", antilist) + objectlist = csv_to_list("objects", antilist) + fictionallist = csv_to_list( + csvfilename="fictional characters", + antilist=antilist, + skipheader=True, + gender=gender, + ) + nonfictionallist = csv_to_list( + csvfilename="nonfictional characters", + antilist=antilist, + skipheader=True, + gender=gender, + ) + conceptsuffixlist = csv_to_list("concept_suffix", antilist) + buildinglist = csv_to_list("buildings", antilist) + vehiclelist = csv_to_list("vehicles", antilist) + outfitlist = csv_to_list("outfits", antilist) + locationlist = csv_to_list("locations", antilist) - accessorielist = csv_to_list("accessories",antilist,"./csvfiles/",0,"?") - artmovementlist = csv_to_list("artmovements",antilist) - bodytypelist = csv_to_list("body_types",antilist) - cameralist = csv_to_list("cameras",antilist) - colorschemelist = csv_to_list("colorscheme",antilist) - conceptprefixlist = csv_to_list("concept_prefix",antilist) - culturelist = csv_to_list("cultures",antilist) - descriptorlist = csv_to_list("descriptors",antilist) - devmessagelist = csv_to_list("devmessages",antilist) - directionlist = csv_to_list("directions",antilist) - emojilist = csv_to_list("emojis",antilist) - eventlist = csv_to_list("events",antilist) - focuslist = csv_to_list("focus",antilist) - greatworklist = csv_to_list("greatworks",antilist) - haircolorlist = csv_to_list("haircolors",antilist) - hairstylelist = csv_to_list("hairstyles",antilist) - hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) - humanactivitylist = csv_to_list("human_activities",antilist,"./csvfiles/",0,"?",False,False) - humanoidlist = csv_to_list("humanoids",antilist) - imagetypelist = csv_to_list("imagetypes",antilist) - joblist = joblist = csv_to_list(csvfilename="jobs",antilist=antilist,skipheader=True,gender=gender) - lenslist = csv_to_list("lenses",antilist) - lightinglist = csv_to_list("lighting",antilist) - malefemalelist = csv_to_list(csvfilename="malefemale",antilist=antilist,skipheader=True,gender=gender) - manwomanlist = csv_to_list(csvfilename="manwoman",antilist=antilist,skipheader=True,gender=gender) - moodlist = csv_to_list("moods",antilist) - othertypelist = csv_to_list("othertypes",antilist) - poselist = csv_to_list("poses",antilist) - qualitylist = csv_to_list("quality",antilist) - shotsizelist = csv_to_list("shotsizes",antilist) - timeperiodlist = csv_to_list("timeperiods",antilist) - vomitlist = csv_to_list("vomit",antilist) + accessorielist = csv_to_list("accessories", antilist, "./csvfiles/", 0, "?") + artmovementlist = csv_to_list("artmovements", antilist) + bodytypelist = csv_to_list("body_types", antilist) + cameralist = csv_to_list("cameras", antilist) + colorschemelist = csv_to_list("colorscheme", antilist) + conceptprefixlist = csv_to_list("concept_prefix", antilist) + culturelist = csv_to_list("cultures", antilist) + descriptorlist = csv_to_list("descriptors", antilist) + devmessagelist = csv_to_list("devmessages", antilist) + directionlist = csv_to_list("directions", antilist) + emojilist = csv_to_list("emojis", antilist) + eventlist = csv_to_list("events", antilist) + focuslist = csv_to_list("focus", antilist) + greatworklist = csv_to_list("greatworks", antilist) + haircolorlist = csv_to_list("haircolors", antilist) + hairstylelist = csv_to_list("hairstyles", antilist) + hairvomitlist = csv_to_list( + "hairvomit", antilist, "./csvfiles/", 0, "?", False, False + ) + humanactivitylist = csv_to_list( + "human_activities", antilist, "./csvfiles/", 0, "?", False, False + ) + humanoidlist = csv_to_list("humanoids", antilist) + imagetypelist = csv_to_list("imagetypes", antilist) + joblist = joblist = csv_to_list( + csvfilename="jobs", antilist=antilist, skipheader=True, gender=gender + ) + lenslist = csv_to_list("lenses", antilist) + lightinglist = csv_to_list("lighting", antilist) + malefemalelist = csv_to_list( + csvfilename="malefemale", antilist=antilist, skipheader=True, gender=gender + ) + manwomanlist = csv_to_list( + csvfilename="manwoman", antilist=antilist, skipheader=True, gender=gender + ) + moodlist = csv_to_list("moods", antilist) + othertypelist = csv_to_list("othertypes", antilist) + poselist = csv_to_list("poses", antilist) + qualitylist = csv_to_list("quality", antilist) + shotsizelist = csv_to_list("shotsizes", antilist) + timeperiodlist = csv_to_list("timeperiods", antilist) + vomitlist = csv_to_list("vomit", antilist) foodlist = csv_to_list("foods", antilist) - genderdescriptionlist = csv_to_list(csvfilename="genderdescription",antilist=antilist,skipheader=True,gender=gender) + genderdescriptionlist = csv_to_list( + csvfilename="genderdescription", + antilist=antilist, + skipheader=True, + gender=gender, + ) minilocationlist = csv_to_list("minilocations", antilist) - minioutfitlist = csv_to_list("minioutfits",antilist,"./csvfiles/",0,"?",False,False,gender) + minioutfitlist = csv_to_list( + "minioutfits", antilist, "./csvfiles/", 0, "?", False, False, gender + ) seasonlist = csv_to_list("seasons", antilist) elaborateoutfitlist = csv_to_list("elaborateoutfits", antilist) minivomitlist = csv_to_list("minivomit", antilist) @@ -2992,11 +4317,24 @@ def createpromptvariant(prompt = "", insanitylevel = 5, antivalues = "" , gender poemlinelist = csv_to_list("poemlines", antilist) songlinelist = csv_to_list("songlines", antilist) musicgenrelist = csv_to_list("musicgenres", antilist) - manwomanrelationlist = csv_to_list(csvfilename="manwomanrelations",antilist=antilist,skipheader=True,gender=gender) - manwomanmultiplelist = csv_to_list(csvfilename="manwomanmultiples",antilist=antilist,skipheader=True,gender=gender,delimiter="?") + manwomanrelationlist = csv_to_list( + csvfilename="manwomanrelations", + antilist=antilist, + skipheader=True, + gender=gender, + ) + manwomanmultiplelist = csv_to_list( + csvfilename="manwomanmultiples", + antilist=antilist, + skipheader=True, + gender=gender, + delimiter="?", + ) waterlocationlist = csv_to_list("waterlocations", antilist) containerlist = csv_to_list("containers", antilist) - firstnamelist = csv_to_list(csvfilename="firstnames",antilist=antilist,skipheader=True,gender=gender) + firstnamelist = csv_to_list( + csvfilename="firstnames", antilist=antilist, skipheader=True, gender=gender + ) floralist = csv_to_list("flora", antilist) printlist = csv_to_list("prints", antilist) patternlist = csv_to_list("patterns", antilist) @@ -3004,88 +4342,161 @@ def createpromptvariant(prompt = "", insanitylevel = 5, antivalues = "" , gender cardnamelist = csv_to_list("card_names", antilist) coveringlist = csv_to_list("coverings", antilist) facepartlist = csv_to_list("faceparts", antilist) - humanexpressionlist = csv_to_list(csvfilename="humanexpressions",antilist=antilist,delimiter="?") + humanexpressionlist = csv_to_list( + csvfilename="humanexpressions", antilist=antilist, delimiter="?" + ) humanvomitlist = csv_to_list("humanvomit", antilist) eyecolorlist = csv_to_list("eyecolors", antilist) fashiondesignerlist = csv_to_list("fashiondesigners", antilist) - colorcombinationlist = csv_to_list("colorcombinations", antilist) - materialcombinationlist = csv_to_list("materialcombinations", antilist) + colorcombinationlist = csv_to_list("colorcombinations", antilist) + materialcombinationlist = csv_to_list("materialcombinations", antilist) agelist = csv_to_list("ages", antilist) agecalculatorlist = csv_to_list("agecalculator", antilist) elementlist = csv_to_list("elements", antilist) settinglist = csv_to_list("settings", antilist) charactertypelist = csv_to_list("charactertypes", antilist) objectstoholdlist = csv_to_list("objectstohold", antilist) - episodetitlelist = csv_to_list(csvfilename="episodetitles",antilist=antilist,skipheader=True) + episodetitlelist = csv_to_list( + csvfilename="episodetitles", antilist=antilist, skipheader=True + ) - outfitdescriptorlist = csv_to_list("outfitdescriptors",antilist) - hairdescriptorlist = csv_to_list("hairdescriptors",antilist) - humandescriptorlist = csv_to_list("humandescriptors",antilist) - locationdescriptorlist = csv_to_list("locationdescriptors",antilist) - basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors",antilist) - animaldescriptorlist = csv_to_list("animaldescriptors",antilist) + outfitdescriptorlist = csv_to_list("outfitdescriptors", antilist) + hairdescriptorlist = csv_to_list("hairdescriptors", antilist) + humandescriptorlist = csv_to_list("humandescriptors", antilist) + locationdescriptorlist = csv_to_list("locationdescriptors", antilist) + basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors", antilist) + animaldescriptorlist = csv_to_list("animaldescriptors", antilist) - humanlist = fictionallist + nonfictionallist + humanoidlist + malefemalelist + manwomanlist + manwomanrelationlist + manwomanmultiplelist - objecttotallist = objectlist + buildinglist + vehiclelist + foodlist + spacelist + floralist + containerlist - outfitprinttotallist = objecttotallist + locationlist + colorlist + musicgenrelist + seasonlist + animallist + patternlist + humanlist = ( + fictionallist + + nonfictionallist + + humanoidlist + + malefemalelist + + manwomanlist + + manwomanrelationlist + + manwomanmultiplelist + ) + objecttotallist = ( + objectlist + + buildinglist + + vehiclelist + + foodlist + + spacelist + + floralist + + containerlist + ) + outfitprinttotallist = ( + objecttotallist + + locationlist + + colorlist + + musicgenrelist + + seasonlist + + animallist + + patternlist + ) # build artists list artistlist = [] # create artist list to use in the code, maybe based on category or personal lists - if(artists != "all" and artists != "none" and artists.startswith("personal_artists") == False and artists.startswith("personal artists") == False): - artistlist = artist_category_csv_to_list("artists_and_category",artists) - elif(artists.startswith("personal_artists") == True or artists.startswith("personal artists") == True): - artists = artists.replace(" ","_",-1) # add underscores back in - artistlist = csv_to_list(artists,antilist,"./userfiles/") - elif(artists != "none"): - artistlist = csv_to_list("artists",antilist) + if ( + artists != "all" + and artists != "none" + and artists.startswith("personal_artists") == False + and artists.startswith("personal artists") == False + ): + artistlist = artist_category_csv_to_list("artists_and_category", artists) + elif ( + artists.startswith("personal_artists") == True + or artists.startswith("personal artists") == True + ): + artists = artists.replace(" ", "_", -1) # add underscores back in + artistlist = csv_to_list(artists, antilist, "./userfiles/") + elif artists != "none": + artistlist = csv_to_list("artists", antilist) # create special artists lists, used in templates - fantasyartistlist = artist_category_csv_to_list("artists_and_category","fantasy") - popularartistlist = artist_category_csv_to_list("artists_and_category","popular") - romanticismartistlist = artist_category_csv_to_list("artists_and_category","romanticism") - photographyartistlist = artist_category_csv_to_list("artists_and_category","photography") - portraitartistlist = artist_category_csv_to_list("artists_and_category","portrait") - characterartistlist = artist_category_csv_to_list("artists_and_category","character") - landscapeartistlist = artist_category_csv_to_list("artists_and_category","landscape") - scifiartistlist = artist_category_csv_to_list("artists_and_category","sci-fi") - graphicdesignartistlist = artist_category_csv_to_list("artists_and_category","graphic design") - digitalartistlist = artist_category_csv_to_list("artists_and_category","digital") - architectartistlist = artist_category_csv_to_list("artists_and_category","architecture") - cinemaartistlist = artist_category_csv_to_list("artists_and_category","cinema") + fantasyartistlist = artist_category_csv_to_list("artists_and_category", "fantasy") + popularartistlist = artist_category_csv_to_list("artists_and_category", "popular") + romanticismartistlist = artist_category_csv_to_list( + "artists_and_category", "romanticism" + ) + photographyartistlist = artist_category_csv_to_list( + "artists_and_category", "photography" + ) + portraitartistlist = artist_category_csv_to_list("artists_and_category", "portrait") + characterartistlist = artist_category_csv_to_list( + "artists_and_category", "character" + ) + landscapeartistlist = artist_category_csv_to_list( + "artists_and_category", "landscape" + ) + scifiartistlist = artist_category_csv_to_list("artists_and_category", "sci-fi") + graphicdesignartistlist = artist_category_csv_to_list( + "artists_and_category", "graphic design" + ) + digitalartistlist = artist_category_csv_to_list("artists_and_category", "digital") + architectartistlist = artist_category_csv_to_list( + "artists_and_category", "architecture" + ) + cinemaartistlist = artist_category_csv_to_list("artists_and_category", "cinema") gregmodelist = csv_to_list("gregmode", antilist) # add any other custom lists - stylestiloralist = csv_to_list("styles_ti_lora",antilist,"./userfiles/") - generatestyle = bool(stylestiloralist) # True of not empty + stylestiloralist = csv_to_list("styles_ti_lora", antilist, "./userfiles/") + generatestyle = bool(stylestiloralist) # True of not empty - custominputprefixlist = csv_to_list("custom_input_prefix",antilist,"./userfiles/") - generatecustominputprefix = bool(custominputprefixlist) # True of not empty + custominputprefixlist = csv_to_list("custom_input_prefix", antilist, "./userfiles/") + generatecustominputprefix = bool(custominputprefixlist) # True of not empty - custominputmidlist = csv_to_list("custom_input_mid",antilist,"./userfiles/") - generatecustominputmid = bool(custominputmidlist) # True of not empty + custominputmidlist = csv_to_list("custom_input_mid", antilist, "./userfiles/") + generatecustominputmid = bool(custominputmidlist) # True of not empty - custominputsuffixlist = csv_to_list("custom_input_suffix",antilist,"./userfiles/") - generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty + custominputsuffixlist = csv_to_list("custom_input_suffix", antilist, "./userfiles/") + generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty - customsubjectslist = csv_to_list("custom_subjects",antilist,"./userfiles/") - customoutfitslist = csv_to_list("custom_outfits",antilist,"./userfiles/") + customsubjectslist = csv_to_list("custom_subjects", antilist, "./userfiles/") + customoutfitslist = csv_to_list("custom_outfits", antilist, "./userfiles/") # special lists - backgroundtypelist = csv_to_list("backgroundtypes", antilist,"./csvfiles/special_lists/",0,"?") - insideshotlist = csv_to_list("insideshots", antilist,"./csvfiles/special_lists/",0,"?") - photoadditionlist = csv_to_list("photoadditions", antilist,"./csvfiles/special_lists/",0,"?") - buildhairlist = csv_to_list("buildhair", antilist,"./csvfiles/special_lists/",0,"?") - buildoutfitlist = csv_to_list("buildoutfit", antilist,"./csvfiles/special_lists/",0,"?") - objectadditionslist = csv_to_list("objectadditions", antilist,"./csvfiles/special_lists/",0,"?") - humanadditionlist = csv_to_list("humanadditions", antilist,"./csvfiles/special_lists/",0,"?") - animaladditionlist = csv_to_list("animaladditions", antilist,"./csvfiles/special_lists/",0,"?") - buildaccessorielist = csv_to_list("buildaccessorie", antilist,"./csvfiles/special_lists/",0,"?") - minilocationadditionslist = csv_to_list("minilocationadditions", antilist,"./csvfiles/special_lists/",0,"?") - overalladditionlist = csv_to_list("overalladditions", antilist,"./csvfiles/special_lists/",0,"?") - imagetypemodelist = csv_to_list("imagetypemodes", antilist,"./csvfiles/special_lists/",0,"?") - miniactivitylist = csv_to_list("miniactivity", antilist,"./csvfiles/special_lists/",0,"?") - + backgroundtypelist = csv_to_list( + "backgroundtypes", antilist, "./csvfiles/special_lists/", 0, "?" + ) + insideshotlist = csv_to_list( + "insideshots", antilist, "./csvfiles/special_lists/", 0, "?" + ) + photoadditionlist = csv_to_list( + "photoadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildhairlist = csv_to_list( + "buildhair", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildoutfitlist = csv_to_list( + "buildoutfit", antilist, "./csvfiles/special_lists/", 0, "?" + ) + objectadditionslist = csv_to_list( + "objectadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + humanadditionlist = csv_to_list( + "humanadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + animaladditionlist = csv_to_list( + "animaladditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + buildaccessorielist = csv_to_list( + "buildaccessorie", antilist, "./csvfiles/special_lists/", 0, "?" + ) + minilocationadditionslist = csv_to_list( + "minilocationadditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + overalladditionlist = csv_to_list( + "overalladditions", antilist, "./csvfiles/special_lists/", 0, "?" + ) + imagetypemodelist = csv_to_list( + "imagetypemodes", antilist, "./csvfiles/special_lists/", 0, "?" + ) + miniactivitylist = csv_to_list( + "miniactivity", antilist, "./csvfiles/special_lists/", 0, "?" + ) prompt = prompt.replace(",", " , ") prompt = prompt.replace("(", " ( ") @@ -3100,525 +4511,961 @@ def createpromptvariant(prompt = "", insanitylevel = 5, antivalues = "" , gender originalprompt = prompt ### Get all combinations of 1 to 4 consecutive words - words = prompt.split() num_words = len(words) - + combinations_list = [] - + for length in range(1, 5): # Generate combinations of length 1 to 4 for start_idx in range(num_words - length + 1): end_idx = start_idx + length - combination = ' '.join(words[start_idx:end_idx]) + combination = " ".join(words[start_idx:end_idx]) combinations_list.append(combination) - + maxamountofruns = 4 runs = 0 - if(insanitylevel != 0): + if insanitylevel != 0: print("") print("Creating a prompt variation") print("") - while(originalprompt == prompt and runs != maxamountofruns): + while originalprompt == prompt and runs != maxamountofruns: for combination in combinations_list: lowercase_combination = combination.lower() combination = " " + combination + " " - # some rare changes if needed - if lowercase_combination in [x.lower() for x in humanlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -human- ") + # some rare changes if needed + if lowercase_combination in [ + x.lower() for x in humanlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -human- ") - if lowercase_combination in [x.lower() for x in objecttotallist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -objecttotal- ") - - if lowercase_combination in [x.lower() for x in artistlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -artist- ") - + if lowercase_combination in [ + x.lower() for x in objecttotallist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -objecttotal- ") - if lowercase_combination in [x.lower() for x in colorlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -color- ") + if lowercase_combination in [ + x.lower() for x in artistlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -artist- ") - if lowercase_combination in [x.lower() for x in animallist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -animal- ") - - if lowercase_combination in [x.lower() for x in objectlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -object- ") - - if lowercase_combination in [x.lower() for x in fictionallist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -fictional- ") + if lowercase_combination in [ + x.lower() for x in colorlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -color- ") - - if lowercase_combination in [x.lower() for x in nonfictionallist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -nonfictional- ") + if lowercase_combination in [ + x.lower() for x in animallist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -animal- ") - - #if lowercase_combination in [x.lower() for x in conceptsuffixlist] and chance_roll(insanitylevel, "uncommon"): + if lowercase_combination in [ + x.lower() for x in objectlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -object- ") + + if lowercase_combination in [ + x.lower() for x in fictionallist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -fictional- ") + + if lowercase_combination in [ + x.lower() for x in nonfictionallist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -nonfictional- ") + + # if lowercase_combination in [x.lower() for x in conceptsuffixlist] and chance_roll(insanitylevel, "uncommon"): # prompt = prompt.replace(combination," -conceptsuffix- ") - - if lowercase_combination in [x.lower() for x in buildinglist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -building- ") + if lowercase_combination in [ + x.lower() for x in buildinglist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -building- ") - - if lowercase_combination in [x.lower() for x in vehiclelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -vehicle- ") + if lowercase_combination in [ + x.lower() for x in vehiclelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -vehicle- ") - - if lowercase_combination in [x.lower() for x in outfitlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -outfit- ") + if lowercase_combination in [ + x.lower() for x in outfitlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -outfit- ") - - if lowercase_combination in [x.lower() for x in locationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -location- ") + if lowercase_combination in [ + x.lower() for x in locationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -location- ") - - if lowercase_combination in [x.lower() for x in accessorielist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -accessory- ") + if lowercase_combination in [ + x.lower() for x in accessorielist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -accessory- ") - - if lowercase_combination in [x.lower() for x in artmovementlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -artmovement- ") + if lowercase_combination in [ + x.lower() for x in artmovementlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -artmovement- ") - - if lowercase_combination in [x.lower() for x in bodytypelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -bodytype- ") + if lowercase_combination in [ + x.lower() for x in bodytypelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -bodytype- ") - - if lowercase_combination in [x.lower() for x in cameralist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -camera- ") + if lowercase_combination in [ + x.lower() for x in cameralist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -camera- ") - - if lowercase_combination in [x.lower() for x in colorschemelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -colorscheme- ") + if lowercase_combination in [ + x.lower() for x in colorschemelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -colorscheme- ") - if lowercase_combination in [x.lower() for x in eyecolorlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -eyecolor- ") + if lowercase_combination in [ + x.lower() for x in eyecolorlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -eyecolor- ") - if lowercase_combination in [x.lower() for x in fashiondesignerlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -fashiondesigner- ") + if lowercase_combination in [ + x.lower() for x in fashiondesignerlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -fashiondesigner- ") - if lowercase_combination in [x.lower() for x in colorcombinationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -colorcombination- ") + if lowercase_combination in [ + x.lower() for x in colorcombinationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -colorcombination- ") - if lowercase_combination in [x.lower() for x in materialcombinationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -materialcombination- ") + if lowercase_combination in [ + x.lower() for x in materialcombinationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -materialcombination- ") - if lowercase_combination in [x.lower() for x in photoadditionlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -photoaddition- ") + if lowercase_combination in [ + x.lower() for x in photoadditionlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -photoaddition- ") - if lowercase_combination in [x.lower() for x in agelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -age- ") + if lowercase_combination in [ + x.lower() for x in agelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -age- ") - if lowercase_combination in [x.lower() for x in agecalculatorlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -agecalculator- ") + if lowercase_combination in [ + x.lower() for x in agecalculatorlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -agecalculator- ") - if lowercase_combination in [x.lower() for x in gregmodelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -gregmode- ") + if lowercase_combination in [ + x.lower() for x in gregmodelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -gregmode- ") - if lowercase_combination in [x.lower() for x in elementlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -element- ") + if lowercase_combination in [ + x.lower() for x in elementlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -element- ") - if lowercase_combination in [x.lower() for x in settinglist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -setting- ") - - if lowercase_combination in [x.lower() for x in charactertypelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -charactertype- ") - if lowercase_combination in [x.lower() for x in objectstoholdlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -objectstohold- ") - if lowercase_combination in [x.lower() for x in episodetitlelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -episodetitle- ") + if lowercase_combination in [ + x.lower() for x in settinglist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -setting- ") - - #if lowercase_combination in [x.lower() for x in conceptprefixlist] and chance_roll(insanitylevel, "uncommon"): + if lowercase_combination in [ + x.lower() for x in charactertypelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -charactertype- ") + if lowercase_combination in [ + x.lower() for x in objectstoholdlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -objectstohold- ") + if lowercase_combination in [ + x.lower() for x in episodetitlelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -episodetitle- ") + + # if lowercase_combination in [x.lower() for x in conceptprefixlist] and chance_roll(insanitylevel, "uncommon"): # prompt = prompt.replace(combination," -conceptprefix- ") - - if lowercase_combination in [x.lower() for x in culturelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -culture- ") + if lowercase_combination in [ + x.lower() for x in culturelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -culture- ") - - if lowercase_combination in [x.lower() for x in descriptorlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -descriptor- ") + if lowercase_combination in [ + x.lower() for x in descriptorlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -descriptor- ") - if lowercase_combination in [x.lower() for x in outfitdescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -outfitdescriptor- ") - if lowercase_combination in [x.lower() for x in hairdescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -hairdescriptor- ") - if lowercase_combination in [x.lower() for x in hairvomitlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -hairvomit- ") - if lowercase_combination in [x.lower() for x in humandescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -humandescriptor- ") - if lowercase_combination in [x.lower() for x in locationdescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -locationdescriptor- ") - if lowercase_combination in [x.lower() for x in basicbitchdescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -basicbitchdescriptor- ") - if lowercase_combination in [x.lower() for x in animaldescriptorlist] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination," -animaldescriptor- ") + if lowercase_combination in [ + x.lower() for x in outfitdescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -outfitdescriptor- ") + if lowercase_combination in [ + x.lower() for x in hairdescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -hairdescriptor- ") + if lowercase_combination in [ + x.lower() for x in hairvomitlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -hairvomit- ") + if lowercase_combination in [ + x.lower() for x in humandescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -humandescriptor- ") + if lowercase_combination in [ + x.lower() for x in locationdescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -locationdescriptor- ") + if lowercase_combination in [ + x.lower() for x in basicbitchdescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -basicbitchdescriptor- ") + if lowercase_combination in [ + x.lower() for x in animaldescriptorlist + ] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination, " -animaldescriptor- ") - if lowercase_combination in [x.lower() for x in directionlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -direction- ") + if lowercase_combination in [ + x.lower() for x in directionlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -direction- ") - if lowercase_combination in [x.lower() for x in emojilist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -emoji- ") + if lowercase_combination in [ + x.lower() for x in emojilist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -emoji- ") - if lowercase_combination in [x.lower() for x in humanexpressionlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -humanexpression- ") - if lowercase_combination in [x.lower() for x in humanvomitlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -humanvomit- ") - - if lowercase_combination in [x.lower() for x in eventlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -event- ") + if lowercase_combination in [ + x.lower() for x in humanexpressionlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -humanexpression- ") + if lowercase_combination in [ + x.lower() for x in humanvomitlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -humanvomit- ") - if lowercase_combination in [x.lower() for x in focuslist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -focus- ") + if lowercase_combination in [ + x.lower() for x in eventlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -event- ") - if lowercase_combination in [x.lower() for x in greatworklist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -greatwork- ") + if lowercase_combination in [ + x.lower() for x in focuslist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -focus- ") - if lowercase_combination in [x.lower() for x in haircolorlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -haircolor- ") + if lowercase_combination in [ + x.lower() for x in greatworklist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -greatwork- ") - if lowercase_combination in [x.lower() for x in hairstylelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -hairstyle- ") + if lowercase_combination in [ + x.lower() for x in haircolorlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -haircolor- ") - if lowercase_combination in [x.lower() for x in directionlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -direction- ") + if lowercase_combination in [ + x.lower() for x in hairstylelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -hairstyle- ") - if lowercase_combination in [x.lower() for x in humanoidlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -humanoid- ") + if lowercase_combination in [ + x.lower() for x in directionlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -direction- ") - if lowercase_combination in [x.lower() for x in joblist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -job- ") + if lowercase_combination in [ + x.lower() for x in humanoidlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -humanoid- ") - if lowercase_combination in [x.lower() for x in lenslist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -lens- ") - if lowercase_combination in [x.lower() for x in lightinglist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -lighting- ") - if lowercase_combination in [x.lower() for x in malefemalelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -malefemale- ") - if lowercase_combination in [x.lower() for x in manwomanlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -manwoman- ") - if lowercase_combination in [x.lower() for x in moodlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -mood- ") - if lowercase_combination in [x.lower() for x in othertypelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -othertype- ") - if lowercase_combination in [x.lower() for x in poselist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -pose- ") - if lowercase_combination in [x.lower() for x in qualitylist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -quality- ") - if lowercase_combination in [x.lower() for x in shotsizelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -shotsize- ") - if lowercase_combination in [x.lower() for x in timeperiodlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -timeperiod- ") - if lowercase_combination in [x.lower() for x in vomitlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -vomit- ") - if lowercase_combination in [x.lower() for x in foodlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -food- ") - if lowercase_combination in [x.lower() for x in genderdescriptionlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -genderdescription- ") - if lowercase_combination in [x.lower() for x in minilocationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -minilocation- ") - if lowercase_combination in [x.lower() for x in minioutfitlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -minioutfit- ") - if lowercase_combination in [x.lower() for x in lenslist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -lens- ") - if lowercase_combination in [x.lower() for x in seasonlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -season- ") - if lowercase_combination in [x.lower() for x in imagetypequalitylist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -imagetypequality- ") - if lowercase_combination in [x.lower() for x in rpgclasslist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -rpgclass- ") - if lowercase_combination in [x.lower() for x in brandlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -brand- ") - if lowercase_combination in [x.lower() for x in spacelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -space- ") - if lowercase_combination in [x.lower() for x in poemlinelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -poemline- ") - if lowercase_combination in [x.lower() for x in songlinelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -songline- ") - if lowercase_combination in [x.lower() for x in musicgenrelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -musicgenre- ") - if lowercase_combination in [x.lower() for x in manwomanrelationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -manwomanrelation- ") - if lowercase_combination in [x.lower() for x in manwomanmultiplelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -manwomanmultiple- ") - if lowercase_combination in [x.lower() for x in waterlocationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -waterlocation- ") - if lowercase_combination in [x.lower() for x in containerlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -container- ") - if lowercase_combination in [x.lower() for x in firstnamelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -firstname- ") - if lowercase_combination in [x.lower() for x in floralist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -flora- ") - if lowercase_combination in [x.lower() for x in printlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -print- ") - if lowercase_combination in [x.lower() for x in miniactivitylist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -miniactivity- ") - if lowercase_combination in [x.lower() for x in patternlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -pattern- ") - if lowercase_combination in [x.lower() for x in chairlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -chair- ") - if lowercase_combination in [x.lower() for x in cardnamelist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -cardname- ") - if lowercase_combination in [x.lower() for x in coveringlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -covering- ") - if lowercase_combination in [x.lower() for x in facepartlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -facepart- ") + if lowercase_combination in [ + x.lower() for x in joblist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -job- ") + if lowercase_combination in [ + x.lower() for x in lenslist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -lens- ") + if lowercase_combination in [ + x.lower() for x in lightinglist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -lighting- ") + if lowercase_combination in [ + x.lower() for x in malefemalelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -malefemale- ") + if lowercase_combination in [ + x.lower() for x in manwomanlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -manwoman- ") + if lowercase_combination in [ + x.lower() for x in moodlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -mood- ") + if lowercase_combination in [ + x.lower() for x in othertypelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -othertype- ") + if lowercase_combination in [ + x.lower() for x in poselist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -pose- ") + if lowercase_combination in [ + x.lower() for x in qualitylist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -quality- ") + if lowercase_combination in [ + x.lower() for x in shotsizelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -shotsize- ") + if lowercase_combination in [ + x.lower() for x in timeperiodlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -timeperiod- ") + if lowercase_combination in [ + x.lower() for x in vomitlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -vomit- ") + if lowercase_combination in [ + x.lower() for x in foodlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -food- ") + if lowercase_combination in [ + x.lower() for x in genderdescriptionlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -genderdescription- ") + if lowercase_combination in [ + x.lower() for x in minilocationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -minilocation- ") + if lowercase_combination in [ + x.lower() for x in minioutfitlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -minioutfit- ") + if lowercase_combination in [ + x.lower() for x in lenslist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -lens- ") + if lowercase_combination in [ + x.lower() for x in seasonlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -season- ") + if lowercase_combination in [ + x.lower() for x in imagetypequalitylist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -imagetypequality- ") + if lowercase_combination in [ + x.lower() for x in rpgclasslist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -rpgclass- ") + if lowercase_combination in [ + x.lower() for x in brandlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -brand- ") + if lowercase_combination in [ + x.lower() for x in spacelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -space- ") + if lowercase_combination in [ + x.lower() for x in poemlinelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -poemline- ") + if lowercase_combination in [ + x.lower() for x in songlinelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -songline- ") + if lowercase_combination in [ + x.lower() for x in musicgenrelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -musicgenre- ") + if lowercase_combination in [ + x.lower() for x in manwomanrelationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -manwomanrelation- ") + if lowercase_combination in [ + x.lower() for x in manwomanmultiplelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -manwomanmultiple- ") + if lowercase_combination in [ + x.lower() for x in waterlocationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -waterlocation- ") + if lowercase_combination in [ + x.lower() for x in containerlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -container- ") + if lowercase_combination in [ + x.lower() for x in firstnamelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -firstname- ") + if lowercase_combination in [ + x.lower() for x in floralist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -flora- ") + if lowercase_combination in [ + x.lower() for x in printlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -print- ") + if lowercase_combination in [ + x.lower() for x in miniactivitylist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -miniactivity- ") + if lowercase_combination in [ + x.lower() for x in patternlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -pattern- ") + if lowercase_combination in [ + x.lower() for x in chairlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -chair- ") + if lowercase_combination in [ + x.lower() for x in cardnamelist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -cardname- ") + if lowercase_combination in [ + x.lower() for x in coveringlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -covering- ") + if lowercase_combination in [ + x.lower() for x in facepartlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -facepart- ") - if lowercase_combination in [x.lower() for x in fantasyartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -fantasyartist- ") - if lowercase_combination in [x.lower() for x in popularartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -popularartist- ") - if lowercase_combination in [x.lower() for x in romanticismartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -romanticismartist- ") - if lowercase_combination in [x.lower() for x in photographyartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -photographyartist- ") - if lowercase_combination in [x.lower() for x in portraitartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -portraitartist- ") - if lowercase_combination in [x.lower() for x in characterartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -characterartist- ") - if lowercase_combination in [x.lower() for x in landscapeartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -landscapeartist- ") - if lowercase_combination in [x.lower() for x in scifiartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -scifiartist- ") - if lowercase_combination in [x.lower() for x in graphicdesignartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -graphicdesignartist- ") - if lowercase_combination in [x.lower() for x in architectartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -architectartist- ") - if lowercase_combination in [x.lower() for x in cinemaartistlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -cinemaartist- ") + if lowercase_combination in [ + x.lower() for x in fantasyartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -fantasyartist- ") + if lowercase_combination in [ + x.lower() for x in popularartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -popularartist- ") + if lowercase_combination in [ + x.lower() for x in romanticismartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -romanticismartist- ") + if lowercase_combination in [ + x.lower() for x in photographyartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -photographyartist- ") + if lowercase_combination in [ + x.lower() for x in portraitartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -portraitartist- ") + if lowercase_combination in [ + x.lower() for x in characterartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -characterartist- ") + if lowercase_combination in [ + x.lower() for x in landscapeartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -landscapeartist- ") + if lowercase_combination in [ + x.lower() for x in scifiartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -scifiartist- ") + if lowercase_combination in [ + x.lower() for x in graphicdesignartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -graphicdesignartist- ") + if lowercase_combination in [ + x.lower() for x in architectartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -architectartist- ") + if lowercase_combination in [ + x.lower() for x in cinemaartistlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -cinemaartist- ") - - if lowercase_combination in [x.lower() for x in stylestiloralist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -styletilora- ") - if lowercase_combination in [x.lower() for x in waterlocationlist] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination," -waterlocation- ") + if lowercase_combination in [ + x.lower() for x in stylestiloralist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -styletilora- ") + if lowercase_combination in [ + x.lower() for x in waterlocationlist + ] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination, " -waterlocation- ") runs += 1 - - prompt = prompt.replace(" :", ":") prompt = prompt.replace(": ", ":") completeprompt = prompt - 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 or - "-conceptprefix-" in completeprompt or - "-descriptor-" in completeprompt or - "-food-" in completeprompt or - "-haircolor-" in completeprompt or - "-hairstyle-" in completeprompt or - "-job-" in completeprompt or - "-culture-" in completeprompt or - "-accessory-" in completeprompt or - "-humanoid-" in completeprompt or - "-manwoman-" in completeprompt or - "-human-" in completeprompt or - "-colorscheme-" in completeprompt or - "-mood-" in completeprompt or - "-genderdescription-" in completeprompt or - "-artmovement-" in completeprompt or - "-malefemale-" in completeprompt or - "-objecttotal-" in completeprompt or - "-outfitprinttotal-" in completeprompt or - "-bodytype-" in completeprompt or - "-minilocation-" in completeprompt or - "-minilocationaddition-" in completeprompt or - "-pose-" in completeprompt or - "-season-" in completeprompt or - "-minioutfit-" in completeprompt or - "-elaborateoutfit-" in completeprompt or - "-minivomit-" in completeprompt or - "-vomit-" in completeprompt or - "-rpgclass-" in completeprompt or - "-subjectfromfile-" in completeprompt or - "-outfitfromfile-" in completeprompt or - "-brand-" in completeprompt or - "-space-" in completeprompt or - "-artist-" in completeprompt or - "-imagetype-" in completeprompt or - "-othertype-" in completeprompt or - "-quality-" in completeprompt or - "-lighting-" in completeprompt or - "-camera-" in completeprompt or - "-lens-" in completeprompt or - "-imagetypequality-" in completeprompt or - "-poemline-" in completeprompt or - "-songline-" in completeprompt or - "-greatwork-" in completeprompt or - "-fantasyartist-" in completeprompt or - "-popularartist-" in completeprompt or - "-romanticismartist-" in completeprompt or - "-photographyartist-" in completeprompt or - "-emoji-" in completeprompt or - "-timeperiod-" in completeprompt or - "-shotsize-" in completeprompt or - "-musicgenre-" in completeprompt or - "-animaladdition-" in completeprompt or - "-objectaddition-" in completeprompt or - "-humanaddition-" in completeprompt or - "-overalladdition-" in completeprompt or - "-focus-" in completeprompt or - "-direction-" in completeprompt or - "-styletilora-" in completeprompt or - "-manwomanrelation-" in completeprompt or - "-manwomanmultiple-" in completeprompt or - "-waterlocation-" in completeprompt or - "-container-" in completeprompt or - "-firstname-" in completeprompt or - "-flora-" in completeprompt or - "-print-" in completeprompt or - "-miniactivity-" in completeprompt or - "-pattern-" in completeprompt or - "-chair-" in completeprompt or - "-cardname-" in completeprompt or - "-covering-" in completeprompt or - "-outfitdescriptor-" in completeprompt or - "-hairdescriptor-" in completeprompt or - "-hairvomit-" in completeprompt or - "-humandescriptor-" in completeprompt or - "-facepart-" in completeprompt or - "-locationdescriptor-" in completeprompt or - "-basicbitchdescriptor-" in completeprompt or - "-animaldescriptor-" in completeprompt or - "-humanexpression-" in completeprompt or - "-humanvomit-" in completeprompt or - "-eyecolor-" in completeprompt or - "-fashiondesigner-" in completeprompt or - "-colorcombination-" in completeprompt or - "-materialcombination-" in completeprompt or - "-photoaddition-" in completeprompt or - "-age-" in completeprompt or - "-agecalculator-" in completeprompt or - "-gregmode-" in completeprompt or - "-portraitartist-" in completeprompt or - "-characterartist-" in completeprompt or - "-landscapeartist-" in completeprompt or - "-scifiartist-" in completeprompt or - "-graphicdesignartist-" in completeprompt or - "-digitalartist-" in completeprompt or - "-architectartist-" in completeprompt or - "-cinemaartist-" in completeprompt or - "-element-" in completeprompt or - "-setting-" in completeprompt or - "-charactertype-" in completeprompt or - "-objectstohold-" in completeprompt or - "-episodetitle-" in completeprompt - ): - allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-", "-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-fantasyartist-", "-popularartist-", "-romanticismartist-", "-photographyartist-", "-emoji-", "-timeperiod-", "-shotsize-", "-musicgenre-", "-animaladdition-", "-objectaddition-", "-humanaddition-", "-overalladdition-", "-focus-", "-direction-", "-styletilora-", "-manwomanrelation-", "-waterlocation-", "-container-", "-firstname-", "-flora-", "-print-", "-miniactivity-", "-pattern-", "-chair-", "-cardname-", "-covering-", "-outfitdescriptor-", "-hairdescriptor-", "-hairvomit-", "-humandescriptor-", "-manwomanmultiple-", "-facepart-", "-locationdescriptor-", "-basicbitchdescriptor-", "-animaldescriptor-", "-humanexpression-", "-humanvomit-", "-eyecolor-", "-fashiondesigner-", "-colorcombination-", "-materialcombination-", "-photoaddition-", "-age-", "agecalculator-", "-gregmode-" - ,"-portraitartist-", "-characterartist-" , "-landscapeartist-", "-scifiartist-", "-graphicdesignartist-", "-digitalartist-", "-architectartist-", "-cinemaartist-", "-setting-", "-charactertype-", "-objectstohold-", "-episodetitle-"] - allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, customoutfitslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist, fantasyartistlist, popularartistlist, romanticismartistlist, photographyartistlist, emojilist, timeperiodlist, shotsizelist, musicgenrelist, animaladditionlist, objectadditionslist, humanadditionlist, overalladditionlist, focuslist, directionlist, stylestiloralist, manwomanrelationlist, waterlocationlist, containerlist, firstnamelist, floralist, printlist, miniactivitylist, patternlist, chairlist, cardnamelist, coveringlist, outfitdescriptorlist, hairdescriptorlist, hairvomitlist, humandescriptorlist, manwomanmultiplelist, facepartlist, locationdescriptorlist, basicbitchdescriptorlist, animaldescriptorlist, humanexpressionlist, humanvomitlist, eyecolorlist, fashiondesignerlist, colorcombinationlist, materialcombinationlist, photoadditionlist, agelist, agecalculatorlist, gregmodelist - , portraitartistlist, characterartistlist, landscapeartistlist, scifiartistlist, graphicdesignartistlist, digitalartistlist, architectartistlist, cinemaartistlist, settinglist, charactertypelist, objectstoholdlist, episodetitlelist] - - allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-", "-outfitprinttotal-", "-element-"] - allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist, outfitprinttotallist, elementlist] - - - # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - for wildcard in allwildcardslistnohybrid: - attachedlist = allwildcardslistnohybridlists[allwildcardslistnohybrid.index(wildcard)] - completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,False, advancedprompting) + "-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 + or "-conceptprefix-" in completeprompt + or "-descriptor-" in completeprompt + or "-food-" in completeprompt + or "-haircolor-" in completeprompt + or "-hairstyle-" in completeprompt + or "-job-" in completeprompt + or "-culture-" in completeprompt + or "-accessory-" in completeprompt + or "-humanoid-" in completeprompt + or "-manwoman-" in completeprompt + or "-human-" in completeprompt + or "-colorscheme-" in completeprompt + or "-mood-" in completeprompt + or "-genderdescription-" in completeprompt + or "-artmovement-" in completeprompt + or "-malefemale-" in completeprompt + or "-objecttotal-" in completeprompt + or "-outfitprinttotal-" in completeprompt + or "-bodytype-" in completeprompt + or "-minilocation-" in completeprompt + or "-minilocationaddition-" in completeprompt + or "-pose-" in completeprompt + or "-season-" in completeprompt + or "-minioutfit-" in completeprompt + or "-elaborateoutfit-" in completeprompt + or "-minivomit-" in completeprompt + or "-vomit-" in completeprompt + or "-rpgclass-" in completeprompt + or "-subjectfromfile-" in completeprompt + or "-outfitfromfile-" in completeprompt + or "-brand-" in completeprompt + or "-space-" in completeprompt + or "-artist-" in completeprompt + or "-imagetype-" in completeprompt + or "-othertype-" in completeprompt + or "-quality-" in completeprompt + or "-lighting-" in completeprompt + or "-camera-" in completeprompt + or "-lens-" in completeprompt + or "-imagetypequality-" in completeprompt + or "-poemline-" in completeprompt + or "-songline-" in completeprompt + or "-greatwork-" in completeprompt + or "-fantasyartist-" in completeprompt + or "-popularartist-" in completeprompt + or "-romanticismartist-" in completeprompt + or "-photographyartist-" in completeprompt + or "-emoji-" in completeprompt + or "-timeperiod-" in completeprompt + or "-shotsize-" in completeprompt + or "-musicgenre-" in completeprompt + or "-animaladdition-" in completeprompt + or "-objectaddition-" in completeprompt + or "-humanaddition-" in completeprompt + or "-overalladdition-" in completeprompt + or "-focus-" in completeprompt + or "-direction-" in completeprompt + or "-styletilora-" in completeprompt + or "-manwomanrelation-" in completeprompt + or "-manwomanmultiple-" in completeprompt + or "-waterlocation-" in completeprompt + or "-container-" in completeprompt + or "-firstname-" in completeprompt + or "-flora-" in completeprompt + or "-print-" in completeprompt + or "-miniactivity-" in completeprompt + or "-pattern-" in completeprompt + or "-chair-" in completeprompt + or "-cardname-" in completeprompt + or "-covering-" in completeprompt + or "-outfitdescriptor-" in completeprompt + or "-hairdescriptor-" in completeprompt + or "-hairvomit-" in completeprompt + or "-humandescriptor-" in completeprompt + or "-facepart-" in completeprompt + or "-locationdescriptor-" in completeprompt + or "-basicbitchdescriptor-" in completeprompt + or "-animaldescriptor-" in completeprompt + or "-humanexpression-" in completeprompt + or "-humanvomit-" in completeprompt + or "-eyecolor-" in completeprompt + or "-fashiondesigner-" in completeprompt + or "-colorcombination-" in completeprompt + or "-materialcombination-" in completeprompt + or "-photoaddition-" in completeprompt + or "-age-" in completeprompt + or "-agecalculator-" in completeprompt + or "-gregmode-" in completeprompt + or "-portraitartist-" in completeprompt + or "-characterartist-" in completeprompt + or "-landscapeartist-" in completeprompt + or "-scifiartist-" in completeprompt + or "-graphicdesignartist-" in completeprompt + or "-digitalartist-" in completeprompt + or "-architectartist-" in completeprompt + or "-cinemaartist-" in completeprompt + or "-element-" in completeprompt + or "-setting-" in completeprompt + or "-charactertype-" in completeprompt + or "-objectstohold-" in completeprompt + or "-episodetitle-" in completeprompt + ): + allwildcardslistnohybrid = [ + "-color-", + "-object-", + "-animal-", + "-fictional-", + "-nonfictional-", + "-building-", + "-vehicle-", + "-location-", + "-conceptprefix-", + "-food-", + "-haircolor-", + "-hairstyle-", + "-job-", + "-accessory-", + "-humanoid-", + "-manwoman-", + "-human-", + "-colorscheme-", + "-mood-", + "-genderdescription-", + "-artmovement-", + "-malefemale-", + "-bodytype-", + "-minilocation-", + "-minilocationaddition-", + "-pose-", + "-season-", + "-minioutfit-", + "-elaborateoutfit-", + "-minivomit-", + "-vomit-", + "-rpgclass-", + "-subjectfromfile-", + "-subjectfromfile-", + "-brand-", + "-space-", + "-artist-", + "-imagetype-", + "-othertype-", + "-quality-", + "-lighting-", + "-camera-", + "-lens-", + "-imagetypequality-", + "-poemline-", + "-songline-", + "-greatwork-", + "-fantasyartist-", + "-popularartist-", + "-romanticismartist-", + "-photographyartist-", + "-emoji-", + "-timeperiod-", + "-shotsize-", + "-musicgenre-", + "-animaladdition-", + "-objectaddition-", + "-humanaddition-", + "-overalladdition-", + "-focus-", + "-direction-", + "-styletilora-", + "-manwomanrelation-", + "-waterlocation-", + "-container-", + "-firstname-", + "-flora-", + "-print-", + "-miniactivity-", + "-pattern-", + "-chair-", + "-cardname-", + "-covering-", + "-outfitdescriptor-", + "-hairdescriptor-", + "-hairvomit-", + "-humandescriptor-", + "-manwomanmultiple-", + "-facepart-", + "-locationdescriptor-", + "-basicbitchdescriptor-", + "-animaldescriptor-", + "-humanexpression-", + "-humanvomit-", + "-eyecolor-", + "-fashiondesigner-", + "-colorcombination-", + "-materialcombination-", + "-photoaddition-", + "-age-", + "agecalculator-", + "-gregmode-", + "-portraitartist-", + "-characterartist-", + "-landscapeartist-", + "-scifiartist-", + "-graphicdesignartist-", + "-digitalartist-", + "-architectartist-", + "-cinemaartist-", + "-setting-", + "-charactertype-", + "-objectstohold-", + "-episodetitle-", + ] + allwildcardslistnohybridlists = [ + colorlist, + objectlist, + animallist, + fictionallist, + nonfictionallist, + buildinglist, + vehiclelist, + locationlist, + conceptprefixlist, + foodlist, + haircolorlist, + hairstylelist, + joblist, + accessorielist, + humanoidlist, + manwomanlist, + humanlist, + colorschemelist, + moodlist, + genderdescriptionlist, + artmovementlist, + malefemalelist, + bodytypelist, + minilocationlist, + minilocationadditionslist, + poselist, + seasonlist, + minioutfitlist, + elaborateoutfitlist, + minivomitlist, + vomitlist, + rpgclasslist, + customsubjectslist, + customoutfitslist, + brandlist, + spacelist, + artistlist, + imagetypelist, + othertypelist, + qualitylist, + lightinglist, + cameralist, + lenslist, + imagetypequalitylist, + poemlinelist, + songlinelist, + greatworklist, + fantasyartistlist, + popularartistlist, + romanticismartistlist, + photographyartistlist, + emojilist, + timeperiodlist, + shotsizelist, + musicgenrelist, + animaladditionlist, + objectadditionslist, + humanadditionlist, + overalladditionlist, + focuslist, + directionlist, + stylestiloralist, + manwomanrelationlist, + waterlocationlist, + containerlist, + firstnamelist, + floralist, + printlist, + miniactivitylist, + patternlist, + chairlist, + cardnamelist, + coveringlist, + outfitdescriptorlist, + hairdescriptorlist, + hairvomitlist, + humandescriptorlist, + manwomanmultiplelist, + facepartlist, + locationdescriptorlist, + basicbitchdescriptorlist, + animaldescriptorlist, + humanexpressionlist, + humanvomitlist, + eyecolorlist, + fashiondesignerlist, + colorcombinationlist, + materialcombinationlist, + photoadditionlist, + agelist, + agecalculatorlist, + gregmodelist, + portraitartistlist, + characterartistlist, + landscapeartistlist, + scifiartistlist, + graphicdesignartistlist, + digitalartistlist, + architectartistlist, + cinemaartistlist, + settinglist, + charactertypelist, + objectstoholdlist, + episodetitlelist, + ] + allwildcardslistwithhybrid = [ + "-material-", + "-descriptor-", + "-outfit-", + "-conceptsuffix-", + "-culture-", + "-objecttotal-", + "-outfitprinttotal-", + "-element-", + ] + allwildcardslistwithhybridlists = [ + materiallist, + descriptorlist, + outfitlist, + conceptsuffixlist, + culturelist, + objecttotallist, + outfitprinttotallist, + elementlist, + ] - - for wildcard in allwildcardslistwithhybrid: - attachedlist = allwildcardslistwithhybridlists[allwildcardslistwithhybrid.index(wildcard)] - completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,True, advancedprompting) + # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + for wildcard in allwildcardslistnohybrid: + attachedlist = allwildcardslistnohybridlists[ + allwildcardslistnohybrid.index(wildcard) + ] + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + wildcard, + attachedlist, + False, + advancedprompting, + ) + for wildcard in allwildcardslistwithhybrid: + attachedlist = allwildcardslistwithhybridlists[ + allwildcardslistwithhybrid.index(wildcard) + ] + completeprompt = replacewildcard( + completeprompt, + insanitylevel, + wildcard, + attachedlist, + True, + advancedprompting, + ) - # clean it up completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) - - - - return completeprompt # function -def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehybridorswap, advancedprompting, artiststyleselector = ""): - if(len(listname) == 0): + +def replacewildcard( + completeprompt, + insanitylevel, + wildcard, + listname, + activatehybridorswap, + advancedprompting, + artiststyleselector="", +): + if len(listname) == 0: # handling empty lists - completeprompt = completeprompt.replace(wildcard, "",1) + completeprompt = completeprompt.replace(wildcard, "", 1) else: - while wildcard in completeprompt: - if(unique_dist(insanitylevel) and activatehybridorswap == True and len(listname)>2 and advancedprompting==True): + if ( + unique_dist(insanitylevel) + and activatehybridorswap == True + and len(listname) > 2 + and advancedprompting == True + ): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) replacementvalue = random.choice(listname) listname.remove(replacementvalue) hybridorswapreplacementvalue = "[" + replacementvalue - - if(hybridorswap == "hybrid"): - replacementvalue = random.choice(listname) - listname.remove(replacementvalue) - hybridorswapreplacementvalue += "|" + replacementvalue + "] " - if(hybridorswap == "swap"): - replacementvalue = random.choice(listname) - listname.remove(replacementvalue) - hybridorswapreplacementvalue += ":" + replacementvalue + ":" + str(random.randint(1,20)) + "] " - - completeprompt = completeprompt.replace(wildcard, hybridorswapreplacementvalue,1) - #if list is not empty - if(bool(listname)): + if hybridorswap == "hybrid": + replacementvalue = random.choice(listname) + listname.remove(replacementvalue) + hybridorswapreplacementvalue += "|" + replacementvalue + "] " + if hybridorswap == "swap": + replacementvalue = random.choice(listname) + listname.remove(replacementvalue) + hybridorswapreplacementvalue += ( + ":" + replacementvalue + ":" + str(random.randint(1, 20)) + "] " + ) + + completeprompt = completeprompt.replace( + wildcard, hybridorswapreplacementvalue, 1 + ) + + # if list is not empty + if bool(listname): replacementvalue = random.choice(listname) - if(wildcard not in ["-heshe-", "-himher-","-hisher-"]): + if wildcard not in ["-heshe-", "-himher-", "-hisher-"]: listname.remove(replacementvalue) - - else: replacementvalue = "" # override for artist and artiststyle, only for first artist - if(wildcard == "-artist-" and "-artiststyle-" in completeprompt): + if wildcard == "-artist-" and "-artiststyle-" in completeprompt: artiststyles = [] artiststyle = [] chosenartiststyle = "" - artiststyles = artist_category_by_category_csv_to_list("artists_and_category",replacementvalue) + artiststyles = artist_category_by_category_csv_to_list( + "artists_and_category", replacementvalue + ) artiststyle = [x.strip() for x in artiststyles[0].split(",")] - artiststyle = list(filter(lambda x: len(x) > 0, artiststyle)) # remove empty values + artiststyle = list( + filter(lambda x: len(x) > 0, artiststyle) + ) # remove empty values - if(artiststyleselector in artiststyle): + if artiststyleselector in artiststyle: artiststyle.remove(artiststyleselector) # Sorry folks, this only works when you directly select it as a style - if("nudity" in artiststyle): + if "nudity" in artiststyle: artiststyle.remove("nudity") # keep on looping until we have no more wildcards or no more styles to choose from # leftovers will be removed in the cleaning step while bool(artiststyle) and "-artiststyle-" in completeprompt: - chosenartiststyle = random.choice(artiststyle) - completeprompt = completeprompt.replace("-artiststyle-",chosenartiststyle ,1) + completeprompt = completeprompt.replace( + "-artiststyle-", chosenartiststyle, 1 + ) artiststyle.remove(chosenartiststyle) - - # Sneaky overrides for "same" wildcards # Are overwritten with their first parent - if(wildcard == "-outfit-" or wildcard == "-minioutfit-"): - completeprompt = completeprompt.replace("-sameoutfit-", replacementvalue,1) + if wildcard == "-outfit-" or wildcard == "-minioutfit-": + completeprompt = completeprompt.replace( + "-sameoutfit-", replacementvalue, 1 + ) # Why do it in this detail?? Because we can: # Check if "from" exists in the string. For example Chun Li from Streetfighter, becomes Chun li @@ -3631,68 +5478,96 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy else: replacementvalueforoverrides = replacementvalue - if(wildcard in ["-human-" - ,"-humanoid-" - , "-manwoman-" - , "-manwomanrelation-" - , "-manwomanmultiple-"] - and "-samehumansubject-" in completeprompt): - if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): - completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) - - if(wildcard in ["-fictional-" - , "-nonfictional-" - , "-firstname-" - , "-oppositefictional-" - , "-oppositenonfictional-"] - and "-samehumansubject-" in completeprompt): - if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): - completeprompt = completeprompt.replace("-samehumansubject-", replacementvalueforoverrides) - + if ( + wildcard + in [ + "-human-", + "-humanoid-", + "-manwoman-", + "-manwomanrelation-", + "-manwomanmultiple-", + ] + and "-samehumansubject-" in completeprompt + ): + if completeprompt.index(wildcard) < completeprompt.index( + "-samehumansubject-" + ): + completeprompt = completeprompt.replace( + "-samehumansubject-", "the " + replacementvalueforoverrides + ) + + if ( + wildcard + in [ + "-fictional-", + "-nonfictional-", + "-firstname-", + "-oppositefictional-", + "-oppositenonfictional-", + ] + and "-samehumansubject-" in completeprompt + ): + if completeprompt.index(wildcard) < completeprompt.index( + "-samehumansubject-" + ): + completeprompt = completeprompt.replace( + "-samehumansubject-", replacementvalueforoverrides + ) + # job is here, to prevent issue with a job outfit being replace. So doing it later solves that issue - if(wildcard in ["-job-"] - and "-samehumansubject-" in completeprompt): - if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): - completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) - - + if wildcard in ["-job-"] and "-samehumansubject-" in completeprompt: + if completeprompt.index(wildcard) < completeprompt.index( + "-samehumansubject-" + ): + completeprompt = completeprompt.replace( + "-samehumansubject-", "the " + replacementvalueforoverrides + ) + # This one last, since then it is the only subject we have left - if(wildcard in ["-malefemale-"] - and "-samehumansubject-" in completeprompt): - if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): - completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) + if wildcard in ["-malefemale-"] and "-samehumansubject-" in completeprompt: + if completeprompt.index(wildcard) < completeprompt.index( + "-samehumansubject-" + ): + completeprompt = completeprompt.replace( + "-samehumansubject-", "the " + replacementvalueforoverrides + ) - if(wildcard in ["-animal-" - , "-object-" - , "-vehicle-" - , "-food-" - , "-objecttotal-" - , "-space-" - , "-flora-" - , "-location-" - , "-building-"] - and "-sameothersubject-" in completeprompt): - if(completeprompt.index(wildcard) < completeprompt.index("-sameothersubject-")): - completeprompt = completeprompt.replace("-sameothersubject-", "the " + replacementvalueforoverrides) - - - - completeprompt = completeprompt.replace(wildcard, replacementvalue,1) - - + if ( + wildcard + in [ + "-animal-", + "-object-", + "-vehicle-", + "-food-", + "-objecttotal-", + "-space-", + "-flora-", + "-location-", + "-building-", + ] + and "-sameothersubject-" in completeprompt + ): + if completeprompt.index(wildcard) < completeprompt.index( + "-sameothersubject-" + ): + completeprompt = completeprompt.replace( + "-sameothersubject-", "the " + replacementvalueforoverrides + ) + completeprompt = completeprompt.replace(wildcard, replacementvalue, 1) return completeprompt + def replace_match(match): # Extract the first word from the match - words = match.group(0)[1:-1].split('|') + words = match.group(0)[1:-1].split("|") return words[0] -def cleanup(completeprompt, advancedprompting, insanitylevel = 5): +def cleanup(completeprompt, advancedprompting, insanitylevel=5): # This part is turned off, will bring it back later as an option - + # first, move LoRA's to the back dynamically # Find all occurrences of text between < and > using regex @@ -3701,10 +5576,9 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): # Remove the extracted matches from completeprompt # completeprompt = re.sub(r"<[^>]+>", "", completeprompt) - # if we are not using advanced prompting, remove any hybrid stuff: - if(advancedprompting==False): - hybridpattern = r'\[\w+\|\w+\]' + if advancedprompting == False: + hybridpattern = r"\[\w+\|\w+\]" # Replace the matched pattern with the first word in the group completeprompt = re.sub(hybridpattern, replace_match, completeprompt) @@ -3714,118 +5588,125 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): completeprompt = completeprompt.replace("|", " ") # sometimes if there are not enough artist, we get left we things formed as (:1.2) - completeprompt = re.sub('\(\:\d+\.\d+\)', '', completeprompt) + completeprompt = re.sub("\(\:\d+\.\d+\)", "", completeprompt) # lets also remove some wierd stuff on lower insanitylevels - if(insanitylevel < 7): + if insanitylevel < 7: completeprompt = completeprompt.replace("DayGlo", " ") completeprompt = completeprompt.replace("fluorescent", " ") # all cleanup steps moved here - completeprompt = re.sub('\[ ', '[', completeprompt) - completeprompt = re.sub('\[,', '[', completeprompt) - completeprompt = re.sub(' \]', ']', completeprompt) - completeprompt = re.sub(' \|', '|', completeprompt) - completeprompt = re.sub(' \"', '\"', completeprompt) - completeprompt = re.sub('\" ', '\"', completeprompt) - completeprompt = re.sub('\( ', '(', completeprompt) - completeprompt = re.sub(' \(', '(', completeprompt) - completeprompt = re.sub('\) ', ')', completeprompt) - completeprompt = re.sub(' \)', ')', completeprompt) + completeprompt = re.sub("\[ ", "[", completeprompt) + completeprompt = re.sub("\[,", "[", completeprompt) + completeprompt = re.sub(" \]", "]", completeprompt) + completeprompt = re.sub(" \|", "|", completeprompt) + completeprompt = re.sub(' "', '"', completeprompt) + completeprompt = re.sub('" ', '"', completeprompt) + completeprompt = re.sub("\( ", "(", completeprompt) + completeprompt = re.sub(" \(", "(", completeprompt) + completeprompt = re.sub("\) ", ")", completeprompt) + completeprompt = re.sub(" \)", ")", completeprompt) - completeprompt = re.sub(' :', ':', completeprompt) - completeprompt = re.sub(',::', '::', completeprompt) - completeprompt = re.sub(',:', ':', completeprompt) + completeprompt = re.sub(" :", ":", completeprompt) + completeprompt = re.sub(",::", "::", completeprompt) + completeprompt = re.sub(",:", ":", completeprompt) - completeprompt = re.sub(',,', ', ', completeprompt) - completeprompt = re.sub(',,', ', ', completeprompt) - completeprompt = re.sub(',,,', ', ', completeprompt) - completeprompt = re.sub(', ,', ',', completeprompt) - completeprompt = re.sub(' , ', ', ', completeprompt) - completeprompt = re.sub(' ,', ',', completeprompt) - completeprompt = re.sub(',\(', ', (', completeprompt) + completeprompt = re.sub(",,", ", ", completeprompt) + completeprompt = re.sub(",,", ", ", completeprompt) + completeprompt = re.sub(",,,", ", ", completeprompt) + completeprompt = re.sub(", ,", ",", completeprompt) + completeprompt = re.sub(" , ", ", ", completeprompt) + completeprompt = re.sub(" ,", ",", completeprompt) + completeprompt = re.sub(",\(", ", (", completeprompt) while " " in completeprompt: - completeprompt = re.sub(' ', ' ', completeprompt) - completeprompt = re.sub('a The', 'The', completeprompt) - completeprompt = re.sub('the the', 'the', completeprompt) - completeprompt = re.sub(', ,', ',', completeprompt) - completeprompt = re.sub(',,', ',', completeprompt) + completeprompt = re.sub(" ", " ", completeprompt) + completeprompt = re.sub("a The", "The", completeprompt) + completeprompt = re.sub("the the", "the", completeprompt) + completeprompt = re.sub(", ,", ",", completeprompt) + completeprompt = re.sub(",,", ",", completeprompt) - completeprompt = re.sub(', of a', ' of a', completeprompt) - completeprompt = re.sub('of a,', 'of a', completeprompt) - completeprompt = re.sub('of a of a', 'of a', completeprompt) - completeprompt = re.sub(' a a ', ' a ', completeprompt) + completeprompt = re.sub(", of a", " of a", completeprompt) + completeprompt = re.sub("of a,", "of a", completeprompt) + completeprompt = re.sub("of a of a", "of a", completeprompt) + completeprompt = re.sub(" a a ", " a ", completeprompt) # a / an - completeprompt = re.sub(' a a', ' an a', completeprompt) - completeprompt = re.sub(' a e', ' an e', completeprompt) - completeprompt = re.sub(' a i', ' an i', completeprompt) - completeprompt = re.sub(' a u', ' an u', completeprompt) - completeprompt = re.sub(' a o', ' an o', completeprompt) + completeprompt = re.sub(" a a", " an a", completeprompt) + completeprompt = re.sub(" a e", " an e", completeprompt) + completeprompt = re.sub(" a i", " an i", completeprompt) + completeprompt = re.sub(" a u", " an u", completeprompt) + completeprompt = re.sub(" a o", " an o", completeprompt) + completeprompt = re.sub("art art", "art", completeprompt) + completeprompt = re.sub("-artiststyle- art,", "", completeprompt) + completeprompt = re.sub("-artiststyle- art", "", completeprompt) + completeprompt = re.sub("-artiststyle-", "", completeprompt) + completeprompt = re.sub("- art ", "", completeprompt) - completeprompt = re.sub('art art', 'art', completeprompt) - completeprompt = re.sub('-artiststyle- art,', '', completeprompt) - completeprompt = re.sub('-artiststyle- art', '', completeprompt) - completeprompt = re.sub('-artiststyle-', '', completeprompt) - completeprompt = re.sub('- art ', '', completeprompt) - - - completeprompt = re.sub('a his', 'his', completeprompt) - completeprompt = re.sub('a her', 'her', completeprompt) - completeprompt = re.sub('they is', 'they are', completeprompt) - completeprompt = re.sub('they has', 'they have', completeprompt) + completeprompt = re.sub("a his", "his", completeprompt) + completeprompt = re.sub("a her", "her", completeprompt) + completeprompt = re.sub("they is", "they are", completeprompt) + completeprompt = re.sub("they has", "they have", completeprompt) # some space tricks - completeprompt = re.sub('- shaped', '-shaped', completeprompt) - completeprompt = re.sub('echa- ', 'echa-', completeprompt) - completeprompt = re.sub('style -', 'style-', completeprompt) - - #small fix for multisubject thing - completeprompt = re.sub('a 2', '2', completeprompt) - completeprompt = re.sub('a 3', '3', completeprompt) - completeprompt = re.sub('a 4', '4', completeprompt) - completeprompt = re.sub('a 5', '5', completeprompt) + completeprompt = re.sub("- shaped", "-shaped", completeprompt) + completeprompt = re.sub("echa- ", "echa-", completeprompt) + completeprompt = re.sub("style -", "style-", completeprompt) + # small fix for multisubject thing + completeprompt = re.sub("a 2", "2", completeprompt) + completeprompt = re.sub("a 3", "3", completeprompt) + completeprompt = re.sub("a 4", "4", completeprompt) + completeprompt = re.sub("a 5", "5", completeprompt) # clean up some hacky multiples with adding a s to the end - completeprompt = re.sub('fs ', 'ves ', completeprompt) - completeprompt = re.sub('fs,', 'ves,', completeprompt) - completeprompt = re.sub('sss ', 'ss ', completeprompt) - completeprompt = re.sub('sss,', 'ss,', completeprompt) - completeprompt = re.sub(' Mans', ' Men,', completeprompt) - completeprompt = re.sub(' mans', ' men', completeprompt) - completeprompt = re.sub(' Womans,', ' Women', completeprompt) - completeprompt = re.sub(' womans,', ' women,', completeprompt) - completeprompt = re.sub('\(Mans', '(Men,', completeprompt) - completeprompt = re.sub('\(mans', '(men', completeprompt) - completeprompt = re.sub('\(Womans', '(Women', completeprompt) - completeprompt = re.sub('\(womans', '(women', completeprompt) + completeprompt = re.sub("fs ", "ves ", completeprompt) + completeprompt = re.sub("fs,", "ves,", completeprompt) + completeprompt = re.sub("sss ", "ss ", completeprompt) + completeprompt = re.sub("sss,", "ss,", completeprompt) + completeprompt = re.sub(" Mans", " Men,", completeprompt) + completeprompt = re.sub(" mans", " men", completeprompt) + completeprompt = re.sub(" Womans,", " Women", completeprompt) + completeprompt = re.sub(" womans,", " women,", completeprompt) + completeprompt = re.sub("\(Mans", "(Men,", completeprompt) + completeprompt = re.sub("\(mans", "(men", completeprompt) + completeprompt = re.sub("\(Womans", "(Women", completeprompt) + completeprompt = re.sub("\(womans", "(women", completeprompt) - completeprompt = re.sub('-sameothersubject-', 'it', completeprompt) - completeprompt = re.sub('-samehumansubject-', 'the person', completeprompt) + completeprompt = re.sub("-sameothersubject-", "it", completeprompt) + completeprompt = re.sub("-samehumansubject-", "the person", completeprompt) - - completeprompt = re.sub('(? Date: Fri, 29 Dec 2023 12:01:10 +0100 Subject: [PATCH 02/10] Added smarter subject logic --- build_dynamic_prompt.py | 6042 ++++++++-------------- csvfiles/special_lists/negativewords.csv | 2 + csvfiles/templates/styles.csv | 17 +- negativeprompttester.py | 32 + prompttester.py | 8 +- 5 files changed, 2161 insertions(+), 3940 deletions(-) create mode 100644 csvfiles/special_lists/negativewords.csv create mode 100644 negativeprompttester.py diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 545cbb8..88961fc 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -3,63 +3,24 @@ import re from csv_reader import * from random_functions import * -# For RF only: -# from random_prompt.csv_reader import ( -# load_config_csv, -# csv_to_list, -# artist_category_csv_to_list, -# artist_category_by_category_csv_to_list, -# ) -# from random_prompt.random_functions import ( -# common_dist, -# normal_dist, -# uncommon_dist, -# rare_dist, -# legendary_dist, -# unique_dist, -# extraordinary_dist, -# novel_dist, -# chance_roll, -#) -# builds a prompt dynamically + +#builds a prompt dynamically # insanity level controls randomness of propmt 0-10 # forcesubject van be used to force a certain type of subject -# Set artistmode to none, to exclude artists -def build_dynamic_prompt( - insanitylevel=5, - forcesubject="all", - artists="all", - imagetype="all", - onlyartists=False, - antivalues="", - prefixprompt="", - suffixprompt="", - promptcompounderlevel="1", - seperator="comma", - givensubject="", - smartsubject=True, - giventypeofimage="", - imagemodechance=20, - gender="all", - subtypeobject="all", - subtypehumanoid="all", - subtypeconcept="all", - advancedprompting=True, - hardturnoffemojis=False, - seed=-1, - overrideoutfit="", -): +# Set artistmode to none, to exclude artists +def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all", imagetype = "all", onlyartists = False, antivalues = "", prefixprompt = "", suffixprompt ="",promptcompounderlevel ="1", seperator = "comma", givensubject="",smartsubject = True,giventypeofimage="", imagemodechance = 20, gender = "all", subtypeobject="all", subtypehumanoid="all", subtypeconcept="all", advancedprompting=True, hardturnoffemojis=False, seed=-1, overrideoutfit="", prompt_g_and_l = False): + # set seed # For use in ComfyUI (might bring to Automatic1111 as well) # lets do it when its larger than 0 # Otherwise, just do nothing and it will keep on working based on an earlier set seed - if seed > 0: + if(seed > 0): random.seed(seed) # - if advancedprompting != False and random.randint(0, max(0, insanitylevel - 2)) <= 0: + if(advancedprompting != False and random.randint(0,max(0, insanitylevel - 2)) <= 0): advancedprompting == False originalartistchoice = artists @@ -67,11 +28,13 @@ def build_dynamic_prompt( # load the config file config = load_config_csv() + + # first build up a complete anti list. Those values are removing during list building # this uses the antivalues string AND the antilist.csv emptylist = [] - antilist = csv_to_list("antilist", emptylist, "./userfiles/", 1) - + antilist = csv_to_list("antilist",emptylist , "./userfiles/",1) + antivaluelist = antivalues.split(",") antilist += antivaluelist @@ -80,7 +43,7 @@ def build_dynamic_prompt( antilist = [s.strip().lower() for s in antilist] # Some tricks for gender to make sure we can choose Him/Her/It etc on the right time. - if gender == "all": + if(gender=="all"): genderchoicelist = ["male", "female"] gender = random.choice(genderchoicelist) heshelist = ["it"] @@ -88,118 +51,61 @@ def build_dynamic_prompt( himherlist = ["it"] # we also need to oppositegender for some fun! oppositegender = "male" - if gender == "male": + if(gender=="male"): oppositegender = "female" # build all lists here - colorlist = csv_to_list("colors", antilist) - animallist = csv_to_list("animals", antilist) - materiallist = csv_to_list("materials", antilist) - objectlist = csv_to_list("objects", antilist) - fictionallist = csv_to_list( - csvfilename="fictional characters", - antilist=antilist, - skipheader=True, - gender=gender, - ) - nonfictionallist = csv_to_list( - csvfilename="nonfictional characters", - antilist=antilist, - skipheader=True, - gender=gender, - ) - oppositefictionallist = csv_to_list( - csvfilename="fictional characters", - antilist=antilist, - skipheader=True, - gender=oppositegender, - ) - oppositenonfictionallist = csv_to_list( - csvfilename="nonfictional characters", - antilist=antilist, - skipheader=True, - gender=oppositegender, - ) - conceptsuffixlist = csv_to_list("concept_suffix", antilist) - buildinglist = csv_to_list("buildings", antilist) - vehiclelist = csv_to_list("vehicles", antilist) - outfitlist = csv_to_list("outfits", antilist) - locationlist = csv_to_list("locations", antilist) + colorlist = csv_to_list("colors",antilist) + animallist = csv_to_list("animals",antilist) + materiallist = csv_to_list("materials",antilist) + objectlist = csv_to_list("objects",antilist) + fictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=gender) + nonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=gender) + oppositefictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=oppositegender) + oppositenonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=oppositegender) + conceptsuffixlist = csv_to_list("concept_suffix",antilist) + buildinglist = csv_to_list("buildings",antilist) + vehiclelist = csv_to_list("vehicles",antilist) + outfitlist = csv_to_list("outfits",antilist) + locationlist = csv_to_list("locations",antilist) - accessorielist = csv_to_list( - "accessories", antilist, "./csvfiles/", 0, "?", False, False, gender - ) - artmovementlist = csv_to_list("artmovements", antilist) - bodytypelist = csv_to_list( - "body_types", antilist=antilist, skipheader=True, gender=gender - ) - cameralist = csv_to_list("cameras", antilist) - colorschemelist = csv_to_list("colorscheme", antilist) - conceptprefixlist = csv_to_list("concept_prefix", antilist) - culturelist = csv_to_list("cultures", antilist) - descriptorlist = csv_to_list("descriptors", antilist) - devmessagelist = csv_to_list("devmessages", antilist) - directionlist = csv_to_list( - csvfilename="directions", antilist=antilist, insanitylevel=insanitylevel - ) - emojilist = csv_to_list("emojis", antilist) - eventlist = csv_to_list("events", antilist) - focuslist = csv_to_list( - csvfilename="focus", antilist=antilist, insanitylevel=insanitylevel - ) - greatworklist = csv_to_list("greatworks", antilist) - haircolorlist = csv_to_list("haircolors", antilist) - hairstylelist = csv_to_list("hairstyles", antilist) - hairvomitlist = csv_to_list( - "hairvomit", antilist, "./csvfiles/", 0, "?", False, False - ) - humanactivitylist = csv_to_list( - "human_activities", antilist, "./csvfiles/", 0, "?", False, False - ) - humanoidlist = csv_to_list("humanoids", antilist) - imagetypelist = csv_to_list( - csvfilename="imagetypes", antilist=antilist, insanitylevel=insanitylevel - ) - joblist = csv_to_list( - csvfilename="jobs", antilist=antilist, skipheader=True, gender=gender - ) - lenslist = csv_to_list( - csvfilename="lenses", antilist=antilist, insanitylevel=insanitylevel - ) - lightinglist = csv_to_list( - csvfilename="lighting", antilist=antilist, insanitylevel=insanitylevel - ) - malefemalelist = csv_to_list( - csvfilename="malefemale", antilist=antilist, skipheader=True, gender=gender - ) - manwomanlist = csv_to_list( - csvfilename="manwoman", antilist=antilist, skipheader=True, gender=gender - ) - moodlist = csv_to_list( - csvfilename="moods", antilist=antilist, insanitylevel=insanitylevel - ) - othertypelist = csv_to_list("othertypes", antilist) - poselist = csv_to_list("poses", antilist) - qualitylist = csv_to_list("quality", antilist) - shotsizelist = csv_to_list( - csvfilename="shotsizes", antilist=antilist, insanitylevel=insanitylevel - ) - timeperiodlist = csv_to_list("timeperiods", antilist) - vomitlist = csv_to_list( - csvfilename="vomit", antilist=antilist, insanitylevel=insanitylevel - ) + accessorielist = csv_to_list("accessories",antilist,"./csvfiles/",0,"?",False,False,gender) + artmovementlist = csv_to_list("artmovements",antilist) + bodytypelist = csv_to_list("body_types",antilist=antilist,skipheader=True,gender=gender) + cameralist = csv_to_list("cameras",antilist) + colorschemelist = csv_to_list("colorscheme",antilist) + conceptprefixlist = csv_to_list("concept_prefix",antilist) + culturelist = csv_to_list("cultures",antilist) + descriptorlist = csv_to_list("descriptors",antilist) + devmessagelist = csv_to_list("devmessages",antilist) + directionlist = csv_to_list(csvfilename="directions",antilist=antilist,insanitylevel=insanitylevel) + emojilist = csv_to_list("emojis",antilist) + eventlist = csv_to_list("events",antilist) + focuslist = csv_to_list(csvfilename="focus",antilist=antilist, insanitylevel=insanitylevel) + greatworklist = csv_to_list("greatworks",antilist) + haircolorlist = csv_to_list("haircolors",antilist) + hairstylelist = csv_to_list("hairstyles",antilist) + hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) + humanactivitylist = csv_to_list("human_activities",antilist,"./csvfiles/",0,"?",False,False) + humanoidlist = csv_to_list("humanoids",antilist) + imagetypelist = csv_to_list(csvfilename="imagetypes",antilist=antilist, insanitylevel=insanitylevel) + joblist = csv_to_list(csvfilename="jobs",antilist=antilist,skipheader=True,gender=gender) + lenslist = csv_to_list(csvfilename="lenses",antilist=antilist, insanitylevel=insanitylevel) + lightinglist = csv_to_list(csvfilename="lighting",antilist=antilist, insanitylevel=insanitylevel) + malefemalelist = csv_to_list(csvfilename="malefemale",antilist=antilist,skipheader=True,gender=gender) + manwomanlist = csv_to_list(csvfilename="manwoman",antilist=antilist,skipheader=True,gender=gender) + moodlist = csv_to_list(csvfilename="moods",antilist=antilist, insanitylevel=insanitylevel) + othertypelist = csv_to_list("othertypes",antilist) + poselist = csv_to_list("poses",antilist) + qualitylist = csv_to_list("quality",antilist) + shotsizelist = csv_to_list(csvfilename="shotsizes",antilist=antilist, insanitylevel=insanitylevel) + timeperiodlist = csv_to_list("timeperiods",antilist) + vomitlist = csv_to_list(csvfilename="vomit",antilist=antilist, insanitylevel=insanitylevel) foodlist = csv_to_list("foods", antilist) - genderdescriptionlist = csv_to_list( - csvfilename="genderdescription", - antilist=antilist, - skipheader=True, - gender=gender, - ) + genderdescriptionlist = csv_to_list(csvfilename="genderdescription",antilist=antilist,skipheader=True,gender=gender) minilocationlist = csv_to_list("minilocations", antilist) - minioutfitlist = csv_to_list( - "minioutfits", antilist, "./csvfiles/", 0, "?", False, False, gender - ) + minioutfitlist = csv_to_list("minioutfits",antilist,"./csvfiles/",0,"?",False,False,gender) seasonlist = csv_to_list("seasons", antilist) elaborateoutfitlist = csv_to_list("elaborateoutfits", antilist) minivomitlist = csv_to_list("minivomit", antilist) @@ -210,24 +116,11 @@ def build_dynamic_prompt( poemlinelist = csv_to_list("poemlines", antilist) songlinelist = csv_to_list("songlines", antilist) musicgenrelist = csv_to_list("musicgenres", antilist) - manwomanrelationlist = csv_to_list( - csvfilename="manwomanrelations", - antilist=antilist, - skipheader=True, - gender=gender, - ) - manwomanmultiplelist = csv_to_list( - csvfilename="manwomanmultiples", - antilist=antilist, - skipheader=True, - gender=gender, - delimiter="?", - ) + manwomanrelationlist = csv_to_list(csvfilename="manwomanrelations",antilist=antilist,skipheader=True,gender=gender) + manwomanmultiplelist = csv_to_list(csvfilename="manwomanmultiples",antilist=antilist,skipheader=True,gender=gender,delimiter="?") waterlocationlist = csv_to_list("waterlocations", antilist) containerlist = csv_to_list("containers", antilist) - firstnamelist = csv_to_list( - csvfilename="firstnames", antilist=antilist, skipheader=True, gender=gender - ) + firstnamelist = csv_to_list(csvfilename="firstnames",antilist=antilist,skipheader=True,gender=gender) floralist = csv_to_list("flora", antilist) printlist = csv_to_list("prints", antilist) patternlist = csv_to_list("patterns", antilist) @@ -235,12 +128,8 @@ def build_dynamic_prompt( cardnamelist = csv_to_list("card_names", antilist) coveringlist = csv_to_list("coverings", antilist) facepartlist = csv_to_list("faceparts", antilist) - outfitvomitlist = csv_to_list( - csvfilename="outfitvomit", antilist=antilist, delimiter="?" - ) - humanexpressionlist = csv_to_list( - csvfilename="humanexpressions", antilist=antilist, delimiter="?" - ) + outfitvomitlist = csv_to_list(csvfilename="outfitvomit",antilist=antilist,delimiter="?") + humanexpressionlist = csv_to_list(csvfilename="humanexpressions",antilist=antilist,delimiter="?") humanvomitlist = csv_to_list("humanvomit", antilist) eyecolorlist = csv_to_list("eyecolors", antilist) fashiondesignerlist = csv_to_list("fashiondesigners", antilist) @@ -252,28 +141,19 @@ def build_dynamic_prompt( settinglist = csv_to_list("settings", antilist) charactertypelist = csv_to_list("charactertypes", antilist) objectstoholdlist = csv_to_list("objectstohold", antilist) - episodetitlelist = csv_to_list( - csvfilename="episodetitles", antilist=antilist, skipheader=True - ) + episodetitlelist = csv_to_list(csvfilename="episodetitles",antilist=antilist,skipheader=True) + # additional descriptor lists - outfitdescriptorlist = csv_to_list("outfitdescriptors", antilist) - hairdescriptorlist = csv_to_list("hairdescriptors", antilist) - humandescriptorlist = csv_to_list("humandescriptors", antilist) - locationdescriptorlist = csv_to_list("locationdescriptors", antilist) - basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors", antilist) - animaldescriptorlist = csv_to_list("animaldescriptors", antilist) + outfitdescriptorlist = csv_to_list("outfitdescriptors",antilist) + hairdescriptorlist = csv_to_list("hairdescriptors",antilist) + humandescriptorlist = csv_to_list("humandescriptors",antilist) + locationdescriptorlist = csv_to_list("locationdescriptors",antilist) + basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors",antilist) + animaldescriptorlist = csv_to_list("animaldescriptors",antilist) # descriptorlist becomes one with everything - descriptortotallist = ( - descriptorlist - + outfitdescriptorlist - + hairdescriptorlist - + humandescriptorlist - + locationdescriptorlist - + basicbitchdescriptorlist - + animaldescriptorlist - ) + descriptortotallist = descriptorlist + outfitdescriptorlist + hairdescriptorlist + humandescriptorlist + locationdescriptorlist + basicbitchdescriptorlist + animaldescriptorlist # Deduplicate the list while preserving casings descriptorlist = [] seen_items = set() @@ -281,267 +161,128 @@ def build_dynamic_prompt( for item in descriptortotallist: # Convert the item to lowercase to ignore casing item_lower = item.lower() - + if item_lower not in seen_items: seen_items.add(item_lower) descriptorlist.append(item) humanlist = fictionallist + nonfictionallist + humanoidlist - objecttotallist = ( - objectlist - + buildinglist - + vehiclelist - + foodlist - + spacelist - + floralist - + containerlist - ) - outfitprinttotallist = ( - objecttotallist - + locationlist - + colorlist - + musicgenrelist - + seasonlist - + animallist - + patternlist - ) + objecttotallist = objectlist + buildinglist + vehiclelist + foodlist + spacelist + floralist + containerlist + outfitprinttotallist = objecttotallist + locationlist + colorlist + musicgenrelist + seasonlist + animallist + patternlist - humanactivitycheatinglist = [ - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", - ] + humanactivitycheatinglist = ["OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "OR(;, -heshe- is;uncommon) -miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)"] humanactivitylist = humanactivitylist + humanactivitycheatinglist # build artists list if artists == "wild": artists = "all (wild)" # we want to create more cohorence, so we are adding all (wild) mode for the old logic - + # all else will be more constrained per type, to produce better images. # the popular artists will be used more the lower the insanitylevel is # Future: add in personal artists lists as well - + # lets maybe go wild "sometimes", based on insanitylevel - if artists == "all" and rare_dist(insanitylevel): - artists = "all (wild)" - originalartistchoice = artists + if(artists == "all" and rare_dist(insanitylevel)): + artists = "all (wild)" + originalartistchoice = artists - artisttypes = [ - "popular", - "3D", - "abstract", - "angular", - "anime", - "architecture", - "art nouveau", - "art deco", - "baroque", - "bauhaus", - "cartoon", - "character", - "children's illustration", - "cityscape", - "cinema", - "clean", - "cloudscape", - "collage", - "colorful", - "comics", - "cubism", - "dark", - "detailed", - "digital", - "expressionism", - "fantasy", - "fashion", - "fauvism", - "figurativism", - "graffiti", - "graphic design", - "high contrast", - "horror", - "impressionism", - "installation", - "landscape", - "light", - "line drawing", - "low contrast", - "luminism", - "magical realism", - "manga", - "melanin", - "messy", - "monochromatic", - "nature", - "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", - ] + artisttypes = ["popular", "3D", "abstract", "angular", "anime" ,"architecture", "art nouveau", "art deco", "baroque", "bauhaus", "cartoon", "character", "children's illustration", "cityscape", "cinema", "clean", "cloudscape", "collage", "colorful", "comics", "cubism", "dark", "detailed", "digital", "expressionism", "fantasy", "fashion", "fauvism", "figurativism", "graffiti", "graphic design", "high contrast", "horror", "impressionism", "installation", "landscape", "light", "line drawing", "low contrast", "luminism", "magical realism", "manga", "melanin", "messy", "monochromatic", "nature", "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"] artiststyleselector = "" artiststyleselectormode = "normal" - - if artists == "all" and normal_dist(insanitylevel + 1): + if(artists == "all" and normal_dist(insanitylevel + 1)): artiststyleselector = random.choice(artisttypes) artists = artiststyleselector - elif artists == "all": + elif(artists == "all"): artiststyleselectormode = "custom" - # then else maybe do nothing?? - if random.randint(0, 6) == 0 and onlyartists == False: + # then else maybe do nothing?? + if(random.randint(0,6) == 0 and onlyartists == False): generateartist = False # go popular! Or even worse, we go full greg mode! - elif common_dist(max(3, insanitylevel)): - artists = "popular" + elif(common_dist(max(3,insanitylevel))): + artists = "popular" # only on lower instanity levels anyway - elif insanitylevel < 6: + elif(insanitylevel < 6): artists = "greg mode" else: artists = "popular" + else: artiststyleselectormode = "custom" + + artistlist = [] # create artist list to use in the code, maybe based on category or personal lists - if ( - artists != "all (wild)" - and artists != "all" - and artists != "none" - and artists.startswith("personal_artists") == False - and artists.startswith("personal artists") == False - and artists in artisttypes - ): - artistlist = artist_category_csv_to_list("artists_and_category", artists) - elif ( - artists.startswith("personal_artists") == True - or artists.startswith("personal artists") == True - ): - artists = artists.replace(" ", "_", -1) # add underscores back in - artistlist = csv_to_list(artists, antilist, "./userfiles/") - elif artists != "none": - artistlist = csv_to_list("artists", antilist) + if(artists != "all (wild)" and artists != "all" and artists != "none" and artists.startswith("personal_artists") == False and artists.startswith("personal artists") == False and artists in artisttypes): + artistlist = artist_category_csv_to_list("artists_and_category",artists) + elif(artists.startswith("personal_artists") == True or artists.startswith("personal artists") == True): + artists = artists.replace(" ","_",-1) # add underscores back in + artistlist = csv_to_list(artists,antilist,"./userfiles/") + elif(artists != "none"): + artistlist = csv_to_list("artists",antilist) # create special artists lists, used in templates - fantasyartistlist = artist_category_csv_to_list("artists_and_category", "fantasy") - popularartistlist = artist_category_csv_to_list("artists_and_category", "popular") - romanticismartistlist = artist_category_csv_to_list( - "artists_and_category", "romanticism" - ) - photographyartistlist = artist_category_csv_to_list( - "artists_and_category", "photography" - ) - portraitartistlist = artist_category_csv_to_list("artists_and_category", "portrait") - characterartistlist = artist_category_csv_to_list( - "artists_and_category", "character" - ) - landscapeartistlist = artist_category_csv_to_list( - "artists_and_category", "landscape" - ) - scifiartistlist = artist_category_csv_to_list("artists_and_category", "sci-fi") - graphicdesignartistlist = artist_category_csv_to_list( - "artists_and_category", "graphic design" - ) - digitalartistlist = artist_category_csv_to_list("artists_and_category", "digital") - architectartistlist = artist_category_csv_to_list( - "artists_and_category", "architecture" - ) - cinemaartistlist = artist_category_csv_to_list("artists_and_category", "cinema") + fantasyartistlist = artist_category_csv_to_list("artists_and_category","fantasy") + popularartistlist = artist_category_csv_to_list("artists_and_category","popular") + romanticismartistlist = artist_category_csv_to_list("artists_and_category","romanticism") + photographyartistlist = artist_category_csv_to_list("artists_and_category","photography") + portraitartistlist = artist_category_csv_to_list("artists_and_category","portrait") + characterartistlist = artist_category_csv_to_list("artists_and_category","character") + landscapeartistlist = artist_category_csv_to_list("artists_and_category","landscape") + scifiartistlist = artist_category_csv_to_list("artists_and_category","sci-fi") + graphicdesignartistlist = artist_category_csv_to_list("artists_and_category","graphic design") + digitalartistlist = artist_category_csv_to_list("artists_and_category","digital") + architectartistlist = artist_category_csv_to_list("artists_and_category","architecture") + cinemaartistlist = artist_category_csv_to_list("artists_and_category","cinema") gregmodelist = csv_to_list("gregmode", antilist) + # add any other custom lists - stylestiloralist = csv_to_list("styles_ti_lora", antilist, "./userfiles/") - generatestyle = bool(stylestiloralist) # True of not empty + stylestiloralist = csv_to_list("styles_ti_lora",antilist,"./userfiles/") + generatestyle = bool(stylestiloralist) # True of not empty - custominputprefixlist = csv_to_list("custom_input_prefix", antilist, "./userfiles/") - generatecustominputprefix = bool(custominputprefixlist) # True of not empty + custominputprefixlist = csv_to_list("custom_input_prefix",antilist,"./userfiles/") + generatecustominputprefix = bool(custominputprefixlist) # True of not empty - custominputmidlist = csv_to_list("custom_input_mid", antilist, "./userfiles/") - generatecustominputmid = bool(custominputmidlist) # True of not empty + custominputmidlist = csv_to_list("custom_input_mid",antilist,"./userfiles/") + generatecustominputmid = bool(custominputmidlist) # True of not empty - custominputsuffixlist = csv_to_list("custom_input_suffix", antilist, "./userfiles/") - generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty + custominputsuffixlist = csv_to_list("custom_input_suffix",antilist,"./userfiles/") + generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty - customsubjectslist = csv_to_list("custom_subjects", antilist, "./userfiles/") - customoutfitslist = csv_to_list("custom_outfits", antilist, "./userfiles/") + customsubjectslist = csv_to_list("custom_subjects",antilist,"./userfiles/") + customoutfitslist = csv_to_list("custom_outfits",antilist,"./userfiles/") # special lists - backgroundtypelist = csv_to_list( - "backgroundtypes", antilist, "./csvfiles/special_lists/", 0, "?" - ) - insideshotlist = csv_to_list( - "insideshots", antilist, "./csvfiles/special_lists/", 0, "?" - ) - photoadditionlist = csv_to_list( - "photoadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildhairlist = csv_to_list( - "buildhair", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildoutfitlist = csv_to_list( - "buildoutfit", antilist, "./csvfiles/special_lists/", 0, "?" - ) - objectadditionslist = csv_to_list( - "objectadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - humanadditionlist = csv_to_list( - "humanadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - animaladditionlist = csv_to_list( - "animaladditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildaccessorielist = csv_to_list( - "buildaccessorie", antilist, "./csvfiles/special_lists/", 0, "?" - ) - minilocationadditionslist = csv_to_list( - "minilocationadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - overalladditionlist = csv_to_list( - "overalladditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - imagetypemodelist = csv_to_list( - "imagetypemodes", antilist, "./csvfiles/special_lists/", 0, "?" - ) - miniactivitylist = csv_to_list( - "miniactivity", antilist, "./csvfiles/special_lists/", 0, "?" - ) - animalsuffixadditionlist = csv_to_list( - "animalsuffixadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildfacepartlist = csv_to_list( - "buildfaceparts", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildfacelist = csv_to_list( - "buildface", antilist, "./csvfiles/special_lists/", 0, "?" - ) + backgroundtypelist = csv_to_list("backgroundtypes", antilist,"./csvfiles/special_lists/",0,"?") + insideshotlist = csv_to_list("insideshots", antilist,"./csvfiles/special_lists/",0,"?") + photoadditionlist = csv_to_list("photoadditions", antilist,"./csvfiles/special_lists/",0,"?") + buildhairlist = csv_to_list("buildhair", antilist,"./csvfiles/special_lists/",0,"?") + buildoutfitlist = csv_to_list("buildoutfit", antilist,"./csvfiles/special_lists/",0,"?") + objectadditionslist = csv_to_list("objectadditions", antilist,"./csvfiles/special_lists/",0,"?") + humanadditionlist = csv_to_list("humanadditions", antilist,"./csvfiles/special_lists/",0,"?") + animaladditionlist = csv_to_list("animaladditions", antilist,"./csvfiles/special_lists/",0,"?") + buildaccessorielist = csv_to_list("buildaccessorie", antilist,"./csvfiles/special_lists/",0,"?") + minilocationadditionslist = csv_to_list("minilocationadditions", antilist,"./csvfiles/special_lists/",0,"?") + overalladditionlist = csv_to_list("overalladditions", antilist,"./csvfiles/special_lists/",0,"?") + imagetypemodelist = csv_to_list("imagetypemodes", antilist,"./csvfiles/special_lists/",0,"?") + miniactivitylist = csv_to_list("miniactivity", antilist,"./csvfiles/special_lists/",0,"?") + animalsuffixadditionlist = csv_to_list("animalsuffixadditions", antilist,"./csvfiles/special_lists/",0,"?") + buildfacepartlist = csv_to_list("buildfaceparts", antilist,"./csvfiles/special_lists/",0,"?") + buildfacelist = csv_to_list("buildface", antilist,"./csvfiles/special_lists/",0,"?") + + styleslist = csv_to_list("styles", antilist,"./csvfiles/templates/",0,"?") - styleslist = csv_to_list("styles", antilist, "./csvfiles/templates/", 0, "?") + # subjects mainchooserlist = [] objectwildcardlist = [] @@ -577,432 +318,412 @@ def build_dynamic_prompt( generateepisodetitle = True custominputprefixrepeats = 2 - custominputprefixchance = "uncommon" + custominputprefixchance = 'uncommon' - imagetypechance = "normal" + imagetypechance = 'normal' generateimagetype = True - imagetypequalitychance = "rare" + imagetypequalitychance = 'rare' generateimagetypequality = True generateminilocationaddition = True - minilocationadditionchance = "unique" - artmovementprefixchance = "unique" - minivomitprefix1chance = "rare" - minivomitprefix2chance = "unique" - shotsizechance = "uncommon" + minilocationadditionchance = 'unique' + artmovementprefixchance = 'unique' + minivomitprefix1chance = 'rare' + minivomitprefix2chance = 'unique' + shotsizechance = 'uncommon' - subjectdescriptor1chance = "common" - subjectdescriptor2chance = "uncommon" - subjectbodytypechance = "normal" - subjectculturechance = "normal" - subjectconceptsuffixchance = "unique" + subjectdescriptor1chance = 'common' + subjectdescriptor2chance = 'uncommon' + subjectbodytypechance = 'normal' + subjectculturechance = 'normal' + subjectconceptsuffixchance = 'unique' - subjectlandscapeinsideshotchance = "unique" - subjectlandscapeaddonlocationchance = "normal" - subjectlandscapeaddonlocationdescriptorchance = "rare" - subjectlandscapeaddonlocationculturechance = "rare" + subjectlandscapeinsideshotchance = 'unique' + subjectlandscapeaddonlocationchance = 'normal' + subjectlandscapeaddonlocationdescriptorchance = 'rare' + subjectlandscapeaddonlocationculturechance = 'rare' objectadditionsrepeats = 2 - objectadditionschance = "uncommon" - humanadditionchance = "rare" - overalladditionchance = "extraordinary" + objectadditionschance = 'uncommon' + humanadditionchance = 'rare' + overalladditionchance = 'extraordinary' - emojichance = "legendary" - buildfacechance = "legendary" - humanexpressionchance = "rare" - joboractivitychance = "normal" - humanvomitchance = "rare" + emojichance = 'legendary' + buildfacechance = 'legendary' + humanexpressionchance = 'rare' + joboractivitychance = 'normal' + humanvomitchance = 'rare' custominputmidrepeats = 2 - custominputmidchance = "uncommon" - minivomitmidchance = "unique" + custominputmidchance = 'uncommon' + minivomitmidchance = 'unique' - outfitchance = "normal" - posechance = "uncommon" - hairchance = "normal" - accessorychance = "normal" - humanoidinsideshotchance = "legendary" - humanoidbackgroundchance = "uncommon" + outfitchance = 'normal' + posechance = 'uncommon' + hairchance = 'normal' + accessorychance = 'normal' + humanoidinsideshotchance = 'legendary' + humanoidbackgroundchance = 'uncommon' - landscapeminilocationchance = "uncommon" - generalminilocationchance = "rare" + landscapeminilocationchance = 'uncommon' + generalminilocationchance = 'rare' - timperiodchance = "normal" - focuschance = "normal" - directionchance = "normal" - moodchance = "normal" - minivomitsuffixchance = "unique" - artmovementchance = "normal" - lightingchance = "normal" - photoadditionchance = "common" - lenschance = "normal" - colorschemechance = "normal" - vomit1chance = "uncommon" - vomit2chance = "uncommon" - greatworkchance = "novel" - poemlinechance = "novel" - songlinechance = "novel" - quality1chance = "uncommon" - quality2chance = "uncommon" + timperiodchance = 'normal' + focuschance = 'normal' + directionchance = 'normal' + moodchance = 'normal' + minivomitsuffixchance = 'unique' + artmovementchance = 'normal' + lightingchance = 'normal' + photoadditionchance = 'common' + lenschance = 'normal' + colorschemechance = 'normal' + vomit1chance = 'uncommon' + vomit2chance= 'uncommon' + greatworkchance = 'novel' + poemlinechance = 'novel' + songlinechance = 'novel' + quality1chance = 'uncommon' + quality2chance = 'uncommon' - customstyle1chance = "uncommon" - customstyle2chance = "uncommon" + customstyle1chance = 'uncommon' + customstyle2chance = 'uncommon' custominputsuffixrepeats = 2 - custominputsuffixchance = "uncommon" + custominputsuffixchance = 'uncommon' - artistsatbackchance = "uncommon" + artistsatbackchance = 'uncommon' for item in config: # objects - if item[0] == "subject_vehicle" and item[1] != "on": + if item[0] == 'subject_vehicle' and item[1] != 'on': generatevehicle = False - if item[0] == "subject_object" and item[1] != "on": + if item[0] == 'subject_object' and item[1] != 'on': generateobject = False - if item[0] == "subject_food" and item[1] != "on": + if item[0] == 'subject_food' and item[1] != 'on': generatefood = False - if item[0] == "subject_building" and item[1] != "on": + if item[0] == 'subject_building' and item[1] != 'on': generatebuilding = False - if item[0] == "subject_space" and item[1] != "on": + if item[0] == 'subject_space' and item[1] != 'on': generatespace = False - if item[0] == "subject_flora" and item[1] != "on": + if item[0] == 'subject_flora' and item[1] != 'on': generateflora = False # animals - if item[0] == "subject_animal" and item[1] != "on": + if item[0] == 'subject_animal' and item[1] != 'on': generateanimal = False # humanoids - if item[0] == "subject_manwoman" and item[1] != "on": + if item[0] == 'subject_manwoman' and item[1] != 'on': generatemanwoman = False - if item[0] == "subject_manwomanrelation" and item[1] != "on": + if item[0] == 'subject_manwomanrelation' and item[1] != 'on': generatemanwomanrelation = False - if item[0] == "subject_manwomanmultiple" and item[1] != "on": + if item[0] == 'subject_manwomanmultiple' and item[1] != 'on': generatemanwomanmultiple = False - if item[0] == "subject_fictional" and item[1] != "on": + if item[0] == 'subject_fictional' and item[1] != 'on': generatefictionalcharacter = False - if item[0] == "subject_nonfictional" and item[1] != "on": + if item[0] == 'subject_nonfictional' and item[1] != 'on': generatenonfictionalcharacter = False - if item[0] == "subject_humanoid" and item[1] != "on": + if item[0] == 'subject_humanoid' and item[1] != 'on': generatehumanoids = False - if item[0] == "subject_job" and item[1] != "on": + if item[0] == 'subject_job' and item[1] != 'on': generatejob = False - if item[0] == "subject_firstnames" and item[1] != "on": + if item[0] == 'subject_firstnames' and item[1] != 'on': generatefirstnames = False # landscape - if item[0] == "subject_landscape" and item[1] != "on": + if item[0] == 'subject_landscape' and item[1] != 'on': generatelandscape = False # concept - if item[0] == "subject_event" and item[1] != "on": + if item[0] == 'subject_event' and item[1] != 'on': generateevent = False - if item[0] == "subject_concept" and item[1] != "on": + if item[0] == 'subject_concept' and item[1] != 'on': generateconcepts = False - if item[0] == "subject_poemline" and item[1] != "on": + if item[0] == 'subject_poemline' and item[1] != 'on': generatepoemline = False - if item[0] == "subject_songline" and item[1] != "on": + if item[0] == 'subject_songline' and item[1] != 'on': generatesongline = False - if item[0] == "subject_cardname" and item[1] != "on": + if item[0] == 'subject_cardname' and item[1] != 'on': generatecardname = False - if item[0] == "subject_episodetitle" and item[1] != "on": + if item[0] == 'subject_episodetitle' and item[1] != 'on': generateepisodetitle = False - + # main list stuff - if item[0] == "custominputprefixrepeats": + if item[0] == 'custominputprefixrepeats': custominputprefixrepeats = int(item[1]) - if item[0] == "custominputprefixchance": + if item[0] == 'custominputprefixchance': custominputprefixchance = item[1] - if custominputprefixchance == "never": + if(custominputprefixchance == 'never'): generatecustominputprefix = False - if item[0] == "imagetypechance": + if item[0] == 'imagetypechance': imagetypechance = item[1] - if imagetypechance == "never": + if(imagetypechance == 'never'): generateimagetype = False - if item[0] == "imagetypequalitychance": + if item[0] == 'imagetypequalitychance': imagetypequalitychance = item[1] - if imagetypequalitychance == "never": + if(imagetypequalitychance == 'never'): generateimagetypequality = False - if item[0] == "minilocationadditionchance": + if item[0] == 'minilocationadditionchance': minilocationadditionchance = item[1] - if item[0] == "artmovementprefixchance": + if item[0] == 'artmovementprefixchance': artmovementprefixchance = item[1] - if item[0] == "minivomitprefix1chance": + if item[0] == 'minivomitprefix1chance': minivomitprefix1chance = item[1] - if item[0] == "minivomitprefix2chance": + if item[0] == 'minivomitprefix2chance': minivomitprefix2chance = item[1] - - if item[0] == "shotsizechance": + + if item[0] == 'shotsizechance': shotsizechance = item[1] - if item[0] == "subjectdescriptor1chance": + if item[0] == 'subjectdescriptor1chance': subjectdescriptor1chance = item[1] - if item[0] == "subjectdescriptor2chance": + if item[0] == 'subjectdescriptor2chance': subjectdescriptor2chance = item[1] - if item[0] == "subjectbodytypechance": + if item[0] == 'subjectbodytypechance': subjectbodytypechance = item[1] - if item[0] == "subjectculturechance": + if item[0] == 'subjectculturechance': subjectculturechance = item[1] - if item[0] == "subjectconceptsuffixchance": + if item[0] == 'subjectconceptsuffixchance': subjectconceptsuffixchance = item[1] - if item[0] == "subjectlandscapeinsideshotchance": + if item[0] == 'subjectlandscapeinsideshotchance': subjectlandscapeinsideshotchance = item[1] - if item[0] == "subjectlandscapeaddonlocationchance": + if item[0] == 'subjectlandscapeaddonlocationchance': subjectlandscapeaddonlocationchance = item[1] - if item[0] == "subjectlandscapeaddonlocationdescriptorchance": + if item[0] == 'subjectlandscapeaddonlocationdescriptorchance': subjectlandscapeaddonlocationdescriptorchance = item[1] - if item[0] == "subjectlandscapeaddonlocationculturechance": + if item[0] == 'subjectlandscapeaddonlocationculturechance': subjectlandscapeaddonlocationculturechance = item[1] - if item[0] == "objectadditionsrepeats": + if item[0] == 'objectadditionsrepeats': objectadditionsrepeats = int(item[1]) - if item[0] == "objectadditionschance": + if item[0] == 'objectadditionschance': objectadditionschance = item[1] - if item[0] == "humanadditionchance": + if item[0] == 'humanadditionchance': humanadditionchance = item[1] - if item[0] == "overalladditionchance": + if item[0] == 'overalladditionchance': overalladditionchance = item[1] - if item[0] == "emojichance": + if item[0] == 'emojichance': emojichance = item[1] - if hardturnoffemojis == True: - emojichance = "never" - if item[0] == "buildfacechance": + if(hardturnoffemojis==True): + emojichance='never' + if item[0] == 'buildfacechance': buildfacechance = item[1] - if item[0] == "humanexpressionchance": + if item[0] == 'humanexpressionchance': humanexpressionchance = item[1] - if item[0] == "humanvomitchance": + if item[0] == 'humanvomitchance': humanvomitchance = item[1] - if item[0] == "joboractivitychance": + if item[0] == 'joboractivitychance': joboractivitychance = item[1] - if item[0] == "custominputmidrepeats": + if item[0] == 'custominputmidrepeats': custominputmidrepeats = int(item[1]) - if item[0] == "custominputmidchance": + if item[0] == 'custominputmidchance': custominputmidchance = item[1] - if item[0] == "minivomitmidchance": + if item[0] == 'minivomitmidchance': minivomitmidchance = item[1] - - if item[0] == "outfitchance": + + if item[0] == 'outfitchance': outfitchance = item[1] - if item[0] == "posechance": + if item[0] == 'posechance': posechance = item[1] - if item[0] == "hairchance": + if item[0] == 'hairchance': hairchance = item[1] - if item[0] == "accessorychance": + if item[0] == 'accessorychance': accessorychance = item[1] - if item[0] == "humanoidinsideshotchance": + if item[0] == 'humanoidinsideshotchance': humanoidinsideshotchance = item[1] - if item[0] == "humanoidbackgroundchance": + if item[0] == 'humanoidbackgroundchance': humanoidbackgroundchance = item[1] - if item[0] == "landscapeminilocationchance": + if item[0] == 'landscapeminilocationchance': landscapeminilocationchance = item[1] - if item[0] == "generalminilocationchance": + if item[0] == 'generalminilocationchance': generalminilocationchance = item[1] - if item[0] == "timperiodchance": + if item[0] == 'timperiodchance': timperiodchance = item[1] - if item[0] == "focuschance": + if item[0] == 'focuschance': focuschance = item[1] - if item[0] == "directionchance": + if item[0] == 'directionchance': directionchance = item[1] - if item[0] == "moodchance": + if item[0] == 'moodchance': moodchance = item[1] - if item[0] == "minivomitsuffixchance": + if item[0] == 'minivomitsuffixchance': minivomitsuffixchance = item[1] - if item[0] == "artmovementchance": + if item[0] == 'artmovementchance': artmovementchance = item[1] - if item[0] == "lightingchance": + if item[0] == 'lightingchance': lightingchance = item[1] - if item[0] == "photoadditionchance": + if item[0] == 'photoadditionchance': photoadditionchance = item[1] - if item[0] == "lenschance": + if item[0] == 'lenschance': lenschance = item[1] - if item[0] == "colorschemechance": + if item[0] == 'colorschemechance': colorschemechance = item[1] - if item[0] == "vomit1chance": + if item[0] == 'vomit1chance': vomit1chance = item[1] - if item[0] == "vomit2chance": + if item[0] == 'vomit2chance': vomit2chance = item[1] - if item[0] == "greatworkchance": + if item[0] == 'greatworkchance': greatworkchance = item[1] - if item[0] == "poemlinechance": + if item[0] == 'poemlinechance': poemlinechance = item[1] - if item[0] == "songlinechance": + if item[0] == 'songlinechance': songlinechance = item[1] - if item[0] == "quality1chance": + if item[0] == 'quality1chance': quality1chance = item[1] - if item[0] == "quality2chance": + if item[0] == 'quality2chance': quality2chance = item[1] - if item[0] == "customstyle1chance": + if item[0] == 'customstyle1chance': customstyle1chance = item[1] - if item[0] == "customstyle2chance": + if item[0] == 'customstyle2chance': customstyle2chance = item[1] - - if item[0] == "custominputsuffixrepeats": + + if item[0] == 'custominputsuffixrepeats': custominputsuffixrepeats = int(item[1]) - if item[0] == "custominputsuffixchance": + if item[0] == 'custominputsuffixchance': custominputsuffixchance = item[1] - if item[0] == "artistsatbackchance": + if item[0] == 'artistsatbackchance': artistsatbackchance = item[1] + generatevehicle = bool(vehiclelist) and generatevehicle generateobject = bool(objectlist) and generateobject generatefood = bool(foodlist) and generatefood generatebuilding = bool(buildinglist) and generatebuilding generatespace = bool(spacelist) and generatespace generateflora = bool(floralist) and generateflora - generateobject = ( - generatevehicle - or generateobject - or generatefood - or generatebuilding - or generatespace - or generateflora - ) + generateobject = generatevehicle or generateobject or generatefood or generatebuilding or generatespace or generateflora + - if generatevehicle: + if(generatevehicle): objectwildcardlist.append("-vehicle-") hybridlist.append("-vehicle-") addontolocationlist.append("-vehicle-") - - if generateobject: + + if(generateobject): objectwildcardlist.append("-object-") hybridlist.append("-object-") - if generatefood: + if(generatefood): objectwildcardlist.append("-food-") hybridlist.append("-food-") - - if generatespace: + + if(generatespace): objectwildcardlist.append("-space-") hybridlist.append("-space-") addontolocationlist.append("-space-") - if generatebuilding: + if(generatebuilding): objectwildcardlist.append("-building-") hybridlist.append("-building-") addontolocationlist.append("-building-") addontolocationinsidelist.append("-building-") - - if generateflora: + + if(generateflora): objectwildcardlist.append("-flora-") hybridlist.append("-flora-") addontolocationlist.append("-flora-") - - if generateobject: + + if(generateobject): mainchooserlist.append("object") generatefictionalcharacter = bool(fictionallist) and generatefictionalcharacter - generatenonfictionalcharacter = ( - bool(nonfictionallist) and generatenonfictionalcharacter - ) + generatenonfictionalcharacter = bool(nonfictionallist) and generatenonfictionalcharacter generatehumanoids = bool(humanoidlist) and generatehumanoids generatemanwoman = bool(manwomanlist) and generatemanwoman generatemanwomanrelation = bool(manwomanrelationlist) and generatemanwomanrelation generatemanwomanmultiple = bool(manwomanmultiplelist) and generatemanwomanmultiple generatejob = bool(joblist) and generatejob generatefirstnames = bool(firstnamelist) and generatefirstnames - generatehumanoid = ( - generatefictionalcharacter - or generatenonfictionalcharacter - or generatehumanoids - or generatemanwoman - or generatejob - or generatemanwomanrelation - or generatefirstnames - or generatemanwomanmultiple - ) + generatehumanoid = generatefictionalcharacter or generatenonfictionalcharacter or generatehumanoids or generatemanwoman or generatejob or generatemanwomanrelation or generatefirstnames or generatemanwomanmultiple - if generatefictionalcharacter: + + if(generatefictionalcharacter): humanoidsubjectchooserlist.append("fictional") hybridlist.append("-fictional-") hybridhumanlist.append("-fictional-") - if generatefictionalcharacter: + if(generatefictionalcharacter): humanoidsubjectchooserlist.append("non fictional") hybridlist.append("-nonfictional-") hybridhumanlist.append("-nonfictional-") - - if generatehumanoids: + + if(generatehumanoids): humanoidsubjectchooserlist.append("humanoid") hybridlist.append("-humanoid-") hybridhumanlist.append("-humanoid-") - - if generatemanwoman: + + if(generatemanwoman): humanoidsubjectchooserlist.append("human") - if generatemanwomanrelation: + if(generatemanwomanrelation): humanoidsubjectchooserlist.append("manwomanrelation") - - if generatemanwomanmultiple: + + if(generatemanwomanmultiple): humanoidsubjectchooserlist.append("manwomanmultiple") - if generatejob: + if(generatejob): humanoidsubjectchooserlist.append("job") - - if generatehumanoid: + + if(generatehumanoid): mainchooserlist.append("humanoid") - if generatefirstnames: + if(generatefirstnames): humanoidsubjectchooserlist.append("firstname") - + + generateanimal = bool(animallist) and generateanimal - if generateanimal: + if(generateanimal): mainchooserlist.append("animal") hybridlist.append("-animal-") generatelandscape = bool(locationlist) and generatelandscape - if generatelandscape: + if(generatelandscape): mainchooserlist.append("landscape") addontolocationlist.append("-location-") addontolocationinsidelist.append("-location-") - + generateevent = bool(eventlist) and generateevent - generateconcepts = ( - bool(conceptprefixlist) and bool(conceptsuffixlist) and generateconcepts - ) - generatepoemline = bool(poemlinelist) and generatepoemline + generateconcepts = bool(conceptprefixlist) and bool(conceptsuffixlist) and generateconcepts + generatepoemline = bool(poemlinelist) and generatepoemline generatesongline = bool(songlinelist) and generatesongline generatecardname = bool(cardnamelist) and generatecardname generateepisodetitle = bool(episodetitlelist) and generateepisodetitle + - generateconcept = ( - generateevent or generateconcepts or generatepoemline or generatesongline - ) - if generateevent: + generateconcept = generateevent or generateconcepts or generatepoemline or generatesongline + + if(generateevent): eventsubjectchooserlist.append("event") - - if generateconcepts: + + if(generateconcepts): eventsubjectchooserlist.append("concept") - if generatepoemline: + if(generatepoemline): eventsubjectchooserlist.append("poemline") - - if generatesongline: + + if(generatesongline): eventsubjectchooserlist.append("songline") - - if generatecardname: + + if(generatecardname): eventsubjectchooserlist.append("cardname") - if generateepisodetitle: + if(generateepisodetitle): eventsubjectchooserlist.append("episodetitle") - if generateconcept: + if(generateconcept): mainchooserlist.append("concept") + + # determine wether we have a special mode or not - if ( - random.randint(1, int(imagemodechance)) == 1 - and imagetype == "all" - and giventypeofimage == "" - and onlyartists == False - ): - imagetype = random.choice( - imagetypemodelist - ) # override imagetype with a random "mode" value + if(random.randint(1,int(imagemodechance)) == 1 and imagetype == "all" and giventypeofimage == "" and onlyartists == False): + imagetype = random.choice(imagetypemodelist) # override imagetype with a random "mode" value + specialmode = False templatemode = False @@ -1016,52 +737,53 @@ def build_dynamic_prompt( stylesmode = False # determine wether we should go for a template or not. Not hooked up to insanitylevel - if imagetype == "only templates mode": + if(imagetype == "only templates mode"): specialmode = True templatemode = True print("Running with a randomized template instead of a randomized prompt") - if imagetype == "art blaster mode": + if(imagetype == "art blaster mode"): specialmode = True artblastermode = True print("Running in art blaster mode") - if imagetype == "unique art mode": + if(imagetype == "unique art mode"): specialmode = True uniqueartmode = True print("Running in unique art mode") - if imagetype == "quality vomit mode": + if(imagetype == "quality vomit mode"): specialmode = True qualityvomitmode = True print("Running in quality vomit mode") - if imagetype == "color cannon mode": + if(imagetype == "color cannon mode"): specialmode = True colorcannonmode = True print("Running in color cannon mode") - if imagetype == "photo fantasy mode": + if(imagetype == "photo fantasy mode"): specialmode = True photofantasymode = True print("Running in photo fantasy mode") - if imagetype == "massive madness mode": + if(imagetype == "massive madness mode"): specialmode = True massivemadnessmode = True print("Running in massive madness mode") print("Are you ready for this?") - if imagetype == "subject only mode": + if(imagetype == "subject only mode"): specialmode = True onlysubjectmode = True print("Running in only subject mode") - if imagetype == "fixed styles mode": + if(imagetype == "fixed styles mode"): specialmode = True stylesmode = True print("Running with a randomized style instead of a randomized prompt") + # main stuff generatetype = not specialmode generatesubject = not templatemode @@ -1106,17 +828,20 @@ def build_dynamic_prompt( generatesongline = bool(songlinelist) and not specialmode generatecardname = bool(cardnamelist) and not specialmode generateepisodetitle = bool(episodetitlelist) and not specialmode - + generateminilocationaddition = bool(minilocationadditionslist) and not specialmode generateminivomit = bool(minivomitlist) and not specialmode - generateimagetypequality = ( - bool(imagetypequalitylist) and not specialmode and generateimagetypequality - ) + generateimagetypequality = bool(imagetypequalitylist) and not specialmode and generateimagetypequality generateoveralladdition = bool(overalladditionlist) and not specialmode generateimagetype = bool(imagetypelist) and not specialmode and generateimagetype + # Smart subject logic - if givensubject != "" and smartsubject == True: + givensubjectlist = [] + + if(givensubject != "" and smartsubject == True): + givensubject = givensubject.lower() + # Remove any list that has a matching word in the list # Remove any list/logic with keywords, such as: # wearing, bodytype, pose, location, hair, background @@ -1124,7 +849,7 @@ def build_dynamic_prompt( # first get all the words # Split the string by commas and spaces - words = re.split(r"[,\s]+", givensubject) + words = re.split(r'[,\s]+', givensubject) # Remove leading/trailing whitespaces from each word words = [word.strip() for word in words] @@ -1135,8 +860,8 @@ def build_dynamic_prompt( givensubjectlistsinglewords = list(set(words)) # now get all words clumped together by commas - if "," in givensubject: - allwords = givensubject.split(",") + if ',' in givensubject: + allwords = givensubject.split(',') else: allwords = [givensubject] # Remove leading/trailing whitespaces from each word and convert to lowercase @@ -1147,207 +872,138 @@ def build_dynamic_prompt( givensubjectlist = givensubjectlistsinglewords + givensubjectlistwords + # Check only for the lists that make sense? - + # outfit - foundinlist = any( - word.lower() in [item.lower() for item in outfitlist] - for word in givensubjectlist - ) - keywordslist = ["wearing", "outfit", "dressed"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + foundinlist = any(word.lower() in [item.lower() for item in outfitlist] for word in givensubjectlist) + keywordslist = ["wearing","outfit", "dressed"] + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generateoutfit = False - + # bodytype - foundinlist = any( - word.lower() in [item.lower() for item in bodytypelist] - for word in givensubjectlist - ) - keywordslist = ["bodytype", "body type"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + foundinlist = any(word.lower() in [item.lower() for item in bodytypelist] for word in givensubjectlist) + keywordslist = ["bodytype","body type"] + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatebodytype = False # hair - foundinlist = any( - word.lower() in [item.lower() for item in hairstylelist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in hairstylelist] for word in givensubjectlist) keywordslist = ["hair"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatehairstyle = False - + # descriptorlist - foundinlist = any( - word.lower() in [item.lower() for item in descriptorlist] - for word in givensubjectlist - ) - foundinlist2 = any( - word.lower() in [item.lower() for item in culturelist] - for word in givensubjectlist - ) - if foundinlist == True or foundinlist2 == True: + foundinlist = any(word.lower() in [item.lower() for item in descriptorlist] for word in givensubjectlist) + foundinlist2 = any(word.lower() in [item.lower() for item in culturelist] for word in givensubjectlist) + if(foundinlist == True or foundinlist2 == True): generatedescriptors = False # background - foundinlist = any( - word.lower() in [item.lower() for item in locationlist] - for word in givensubjectlist - ) - foundinlist2 = any( - word.lower() in [item.lower() for item in buildinglist] - for word in givensubjectlist - ) - keywordslist = ["location", "background", "inside"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or foundinlist2 == True or keywordsinstring == True: + foundinlist = any(word.lower() in [item.lower() for item in locationlist] for word in givensubjectlist) + foundinlist2 = any(word.lower() in [item.lower() for item in buildinglist] for word in givensubjectlist) + keywordslist = ["location","background", "inside"] + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or foundinlist2 == True or keywordsinstring == True): generatebackground = False generateinsideshot = False # accessorielist - foundinlist = any( - word.lower() in [item.lower() for item in accessorielist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in accessorielist] for word in givensubjectlist) + if(foundinlist == True): generateaccessorie = False # lenslist - foundinlist = any( - word.lower() in [item.lower() for item in lenslist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in lenslist] for word in givensubjectlist) + if(foundinlist == True): generatelens = False # lightinglist - foundinlist = any( - word.lower() in [item.lower() for item in lightinglist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in lightinglist] for word in givensubjectlist) keywordslist = ["lighting"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatelighting = False # mood - foundinlist = any( - word.lower() in [item.lower() for item in moodlist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in moodlist] for word in givensubjectlist) keywordslist = ["mood"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatemood = False + # poselist - foundinlist = any( - word.lower() in [item.lower() for item in poselist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in poselist] for word in givensubjectlist) keywordslist = ["pose", "posing"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatepose = False # qualitylist - foundinlist = any( - word.lower() in [item.lower() for item in qualitylist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in qualitylist] for word in givensubjectlist) keywordslist = ["quality"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generatequality = False # shotsize - foundinlist = any( - word.lower() in [item.lower() for item in shotsizelist] - for word in givensubjectlist - ) + foundinlist = any(word.lower() in [item.lower() for item in shotsizelist] for word in givensubjectlist) keywordslist = ["shot"] - keywordsinstring = any( - word.lower() in givensubject.lower() for word in keywordslist - ) - if foundinlist == True or keywordsinstring == True: + keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + if(foundinlist == True or keywordsinstring == True): generateshot = False # timeperiodlist - foundinlist = any( - word.lower() in [item.lower() for item in timeperiodlist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in timeperiodlist] for word in givensubjectlist) + if(foundinlist == True): generatetimeperiod = False # vomit - foundinlist = any( - word.lower() in [item.lower() for item in vomitlist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in vomitlist] for word in givensubjectlist) + if(foundinlist == True): generatevomit = False # directionlist - foundinlist = any( - word.lower() in [item.lower() for item in directionlist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in directionlist] for word in givensubjectlist) + if(foundinlist == True): generatedirection = False # focus - foundinlist = any( - word.lower() in [item.lower() for item in focuslist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in focuslist] for word in givensubjectlist) + if(foundinlist == True): generatefocus = False # artmovementlist - foundinlist = any( - word.lower() in [item.lower() for item in artmovementlist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in artmovementlist] for word in givensubjectlist) + if(foundinlist == True): generateartmovement = False - + # camera - foundinlist = any( - word.lower() in [item.lower() for item in cameralist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in cameralist] for word in givensubjectlist) + if(foundinlist == True): generatecamera = False # colorschemelist - foundinlist = any( - word.lower() in [item.lower() for item in colorschemelist] - for word in givensubjectlist - ) - if foundinlist == True: + foundinlist = any(word.lower() in [item.lower() for item in colorschemelist] for word in givensubjectlist) + if(foundinlist == True): generatecolorscheme = False - completeprompt = "" + # given subject subject override :p + subjectingivensubject = False + if("subject" in list(map(str.lower, givensubjectlist)) and smartsubject == True): + givensubjectpromptlist = givensubject.split("subject") + subjectingivensubject = True + + completeprompt = "" + + + + promptstocompound = int(promptcompounderlevel) compoundcounter = 0 @@ -1364,16 +1020,15 @@ def build_dynamic_prompt( buildingfullmode = False subjectchooser = "" mainchooser = "" - + completeprompt += prefixprompt completeprompt += ", " - if templatemode == True: - templatelist = csv_to_list( - "templates", antilist, "./csvfiles/templates/", 1, ";", True - ) + if(templatemode==True): + templatelist = csv_to_list("templates", antilist,"./csvfiles/templates/",1,";",True) + # templateenvironments = [templateenvironment[1] for templateenvironment in templatelist] # templateenvironmentsources = [templateenvironmentsource[2] for templateenvironmentsource in templatelist] # templatesubjecttypes = [templatesubjecttype[3] for templatesubjecttype in templatelist] @@ -1384,526 +1039,397 @@ def build_dynamic_prompt( # takes the prompt based on filters: # targettemplateenvironment: either civitai model or website # templateenvironmentsources: either - templateprompts = [ - templateprompt[0] - for templateprompt in templatelist - if ( - ( - templateprompt[1] == targettemplateenvironment - or targettemplateenvironment == "all" - ) - and ( - templateprompt[2] == templateenvironmentsources - or templateenvironmentsources == "all" - ) - and (templateprompt[3] == forcesubject or forcesubject == "all") - ) - ] - templatepromptcreator = [ - templateprompt[1] - for templateprompt in templatelist - if ( - ( - templateprompt[1] == targettemplateenvironment - or targettemplateenvironment == "all" - ) - and ( - templateprompt[2] == templateenvironmentsources - or templateenvironmentsources == "all" - ) - and (templateprompt[3] == forcesubject or forcesubject == "all") - ) - ] - templatesubjects = [ - templateprompt[4] - for templateprompt in templatelist - if ( - ( - templateprompt[1] == targettemplateenvironment - or targettemplateenvironment == "all" - ) - and ( - templateprompt[2] == templateenvironmentsources - or templateenvironmentsources == "all" - ) - and (templateprompt[3] == forcesubject or forcesubject == "all") - ) - ] - + templateprompts = [templateprompt[0] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] + templatepromptcreator = [templateprompt[1] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] + templatesubjects= [templateprompt[4] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") )] + # choose the template chosentemplate = random.choice(templateprompts) templateindex = templateprompts.index(chosentemplate) - print( - "Processing a prompt that was inspired from: " - + templatepromptcreator[templateindex] - ) + print("Processing a prompt that was inspired from: " + templatepromptcreator[templateindex]) # if there is a subject override, then replace the subject with that - if givensubject == "": - completeprompt += chosentemplate.replace( - "-subject-", templatesubjects[templateindex] - ) - else: - completeprompt += chosentemplate.replace("-subject-", givensubject) + if(givensubject==""): + completeprompt += chosentemplate.replace("-subject-",templatesubjects[templateindex] ) + elif(givensubject != "" and subjectingivensubject == False): + completeprompt += chosentemplate.replace("-subject-",givensubject ) + elif(givensubject != "" and subjectingivensubject == True): + completeprompt += chosentemplate.replace("-subject-", givensubjectpromptlist[0] + " " + templatesubjects[templateindex] + " " + givensubjectpromptlist[1]) + + # custom prefix list for i in range(custominputprefixrepeats): - if ( - chance_roll(insanitylevel, custominputprefixchance) - and generatecustominputprefix == True - ): + if(chance_roll(insanitylevel, custominputprefixchance) and generatecustominputprefix == True): completeprompt += random.choice(custominputprefixlist) + ", " - if insanitylevel == 0: - insanitylevel = random.randint( - 1, 10 - ) # 10 = add everything, 1 is add almost nothing - insanitylevel3 = int((insanitylevel / 3) + 1.20) + + + if(insanitylevel==0): + insanitylevel = random.randint(1, 10) # 10 = add everything, 1 is add almost nothing + insanitylevel3 = int((insanitylevel/3) + 1.20) # print("Setting insanity level to " + str(insanitylevel)) # main chooser: 0 object, 1 animal, 2 humanoid, 3 landscape, 4 event/concept - # mainchooserlist = ["object","animal","humanoid", "landscape", "concept"] + #mainchooserlist = ["object","animal","humanoid", "landscape", "concept"] # ["popular", "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", "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"] - + # Some new logic, lets base the main chooser list on the chosen art category, to make it more cohorent # first for humanoids - artiststylelistforchecking = [ - "popular", - "3D", - "anime" "art nouveau", - "art deco", - "character", - "fantasy", - "fashion", - "manga", - "photography", - "portrait", - "sci-fi", - ] - if ( - artiststyleselector in artiststylelistforchecking - or artists in artiststylelistforchecking - ) and (forcesubject == "all" or forcesubject == ""): + artiststylelistforchecking = ["popular", "3D", "anime" "art nouveau", "art deco", "character", "fantasy", "fashion", "manga", "photography","portrait","sci-fi"] + if((artiststyleselector in artiststylelistforchecking + or artists in artiststylelistforchecking) + and (forcesubject == "all" or forcesubject == "")): + # remove the shizzle based on chance? # we want it to be MORE diverce when the insanity level raises # in this case, raise the chance for a humanoid, gets more wierd when going above 5 - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "concept" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "concept" in mainchooserlist): mainchooserlist.remove("concept") - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "landscape" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "landscape" in mainchooserlist): mainchooserlist.remove("landscape") - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "object" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "object" in mainchooserlist): mainchooserlist.remove("object") - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "animal" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "animal" in mainchooserlist): mainchooserlist.remove("animal") - + # second for landscapes # Some new logic, lets base the main chooser list on the chosen art category, to make it more cohorent - artiststylelistforchecking = [ - "architecture", - "bauhaus", - "cityscape", - "cinema", - "cloudscape", - "impressionism", - "installation", - "landscape", - "magical realism", - "nature", - "romanticism", - "seascape", - "space", - "streetscape", - ] - - if ( - artiststyleselector in artiststylelistforchecking - or artists in artiststylelistforchecking - ) and (forcesubject == "all" or forcesubject == ""): + artiststylelistforchecking = ["architecture","bauhaus", "cityscape", "cinema", "cloudscape","impressionism", "installation", "landscape","magical realism", "nature", "romanticism","seascape", "space", "streetscape"] + + if((artiststyleselector in artiststylelistforchecking + or artists in artiststylelistforchecking) + and (forcesubject == "all" or forcesubject == "")): + # remove the shizzle based on chance? # we want it to be MORE diverce when the insanity level raises # in this case, raise the chance for a landscape, gets more wierd when going above 5 - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "concept" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "concept" in mainchooserlist): mainchooserlist.remove("concept") - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "animal" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "animal" in mainchooserlist): mainchooserlist.remove("animal") - if ( - random.randint(0, 6) > max(2, insanitylevel - 2) - and "object" in mainchooserlist - ): + if(random.randint(0,6) > max(2,insanitylevel -2) and "object" in mainchooserlist): mainchooserlist.remove("object") - if ( - random.randint(0, 8) > max(2, insanitylevel - 2) - and "humanoid" in mainchooserlist - ): + if(random.randint(0,8) > max(2,insanitylevel -2) and "humanoid" in mainchooserlist): mainchooserlist.remove("humanoid") + # choose the main subject type mainchooser = random.choice(mainchooserlist) - - if forcesubject != "" and forcesubject != "all": - mainchooser = forcesubject + + if(forcesubject != "" and forcesubject != "all"): + mainchooser = forcesubject # 0 object, 1 animal, 2 animal as human, 3 ManWoman, 4 Job, 5 fictional, 6 non fictional, 7 humanoid, 8 landscape, 9 event - if mainchooser == "object": + if(mainchooser == "object"): subjectchooser = "object" - if mainchooser == "animal": + if(mainchooser == "animal"): # sometimes interpret the animal as a human - if random.randint(0, 5) < 5: + if(random.randint(0,5) < 5): subjectchooser = "animal" else: subjectchooser = "animal as human" - if mainchooser == "humanoid": - # humanoidsubjectchooserlist = ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] + if(mainchooser == "humanoid"): + #humanoidsubjectchooserlist = ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] # Lets put generic humans as a more 'normal' value. Manwoman relation as the least picked. # balanced around 5, to have more normal man/woman # lower values even more stable # Upper values are still quite random - humanoidsubjectchooserlistbackup = ( - humanoidsubjectchooserlist.copy() - ) # make a backup of the list - if ( - random.randint(0, 9) > max(2, insanitylevel - 2) - and "manwomanrelation" in humanoidsubjectchooserlist - ): + humanoidsubjectchooserlistbackup = humanoidsubjectchooserlist.copy() # make a backup of the list + if(random.randint(0,20) > max(2,insanitylevel -2) and "manwomanrelation" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("manwomanrelation") - if ( - random.randint(0, 5) > max(2, insanitylevel - 2) - and "manwomanmultiple" in humanoidsubjectchooserlist - ): + if(random.randint(0,30) > max(2,insanitylevel -2) and "manwomanmultiple" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("manwomanmultiple") - if ( - random.randint(0, 7) > max(2, insanitylevel - 2) - and "firstname" in humanoidsubjectchooserlist - ): + if(random.randint(0,7) > max(2,insanitylevel -2) and "firstname" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("firstname") - if ( - random.randint(0, 5) > max(2, insanitylevel - 2) - and "job" in humanoidsubjectchooserlist - ): + if(random.randint(0,5) > max(2,insanitylevel -2) and "job" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("job") - if ( - random.randint(0, 5) > max(2, insanitylevel - 2) - and "fictional" in humanoidsubjectchooserlist - ): + if(random.randint(0,5) > max(2,insanitylevel -2) and "fictional" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("fictional") - if ( - random.randint(0, 5) > max(2, insanitylevel - 2) - and "non fictional" in humanoidsubjectchooserlist - ): + if(random.randint(0,5) > max(2,insanitylevel -2) and "non fictional" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("non fictional") - if ( - random.randint(0, 5) > max(2, insanitylevel - 2) - and "humanoid" in humanoidsubjectchooserlist - ): + if(random.randint(0,5) > max(2,insanitylevel -2) and "humanoid" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("humanoid") # more random stuff on higher levels - if ( - random.randint(0, 4) > max(2, insanitylevel - 2) - and "human" in humanoidsubjectchooserlist - ): + if(random.randint(0,4) > max(2,insanitylevel -2) and "human" in humanoidsubjectchooserlist): humanoidsubjectchooserlist.remove("human") # if we accidently remove everything, then restore the backup list - if not bool(humanoidsubjectchooserlist): + if(not bool(humanoidsubjectchooserlist)): humanoidsubjectchooserlist = humanoidsubjectchooserlistbackup - + subjectchooser = random.choice(humanoidsubjectchooserlist) - - if subtypehumanoid != "all": - if subtypehumanoid == "generic humans": + + + + if(subtypehumanoid != "all"): + if(subtypehumanoid == "generic humans"): subjectchooser = "human" - if subtypehumanoid == "generic human relations": + if(subtypehumanoid == "generic human relations"): subjectchooser = "manwomanrelation" - if subtypehumanoid == "multiple humans": + if(subtypehumanoid == "multiple humans"): subjectchooser = "manwomanmultiple" - if subtypehumanoid == "celebrities e.a.": + if(subtypehumanoid == "celebrities e.a."): subjectchooser = "non fictional" - if subtypehumanoid == "fictional characters": + if(subtypehumanoid == "fictional characters"): subjectchooser = "fictional" - if subtypehumanoid == "humanoids": + if(subtypehumanoid == "humanoids"): subjectchooser = "humanoid" - if subtypehumanoid == "based on job or title": + if(subtypehumanoid == "based on job or title"): subjectchooser = "job" - if subtypehumanoid == "based on first name": + if(subtypehumanoid == "based on first name"): subjectchooser = "firstname" - if mainchooser == "landscape": + if(mainchooser == "landscape"): subjectchooser = "landscape" - if mainchooser == "concept": - # eventsubjectchooserlist = ["event", "concept", "poemline", "songline"] + if(mainchooser == "concept"): + #eventsubjectchooserlist = ["event", "concept", "poemline", "songline"] subjectchooser = random.choice(eventsubjectchooserlist) - if subtypeconcept != "all": - if subtypeconcept == "event": + if(subtypeconcept != "all"): + if(subtypeconcept == "event"): subjectchooser = "event" - if subtypeconcept == "the X of Y concepts": + if(subtypeconcept == "the X of Y concepts"): subjectchooser = "concept" - if subtypeconcept == "lines from poems": + if(subtypeconcept == "lines from poems"): subjectchooser = "poemline" - if subtypeconcept == "lines from songs": + if(subtypeconcept == "lines from songs"): subjectchooser = "songline" - if subtypeconcept == "names from card based games": + if(subtypeconcept == "names from card based games"): subjectchooser = "cardname" - if subtypeconcept == "episode titles from tv shows": + if(subtypeconcept == "episode titles from tv shows"): subjectchooser = "episodetitle" # After we chose the subject, lets set all things ready for He/She/It etc - - if ( - subjectchooser in ["manwomanmultiple"] - and givensubject != "" - and subtypehumanoid != "multiple humans" - ): + + if(subjectchooser in ["manwomanmultiple"] and givensubject != "" and subtypehumanoid != "multiple humans"): heshelist = ["they"] hisherlist = ["their"] himherlist = ["them"] # on rare occasions do "one of them" - if random.randint(0, 20) == 0: + if(random.randint(0,20) == 0): heshelist = ["one of them"] hisherlist = ["one of their"] himherlist = ["one of them"] - elif subjectchooser in [ - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "firstname", - "manwomanmultiple", - ]: - if gender == "male": + elif(subjectchooser in ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","firstname","manwomanmultiple"]): + if(gender == "male"): heshelist = ["he"] hisherlist = ["his"] himherlist = ["him"] - if gender == "female": + if(gender == "female"): heshelist = ["she"] hisherlist = ["her"] himherlist = ["her"] - if subjectchooser in ["manwomanmultiple"] and givensubject == "": + if(subjectchooser in ["manwomanmultiple"] and givensubject == ""): heshelist = ["they"] hisherlist = ["their"] himherlist = ["them"] # on rare occasions do "one of them" - if random.randint(0, 20) == 0: + if(random.randint(0,20) == 0): heshelist = ["one of them"] hisherlist = ["one of their"] himherlist = ["one of them"] + - # special modes + + + + + # special modes # start art blaster here - if artblastermode == True: + if(artblastermode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(artistlist): + if(uncommon_dist(insanitylevel) and bool(artistlist)): completeprompt += "-artist-, " - if uncommon_dist(insanitylevel) and bool(artmovementlist): + if(uncommon_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(vomitlist): + if(unique_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if unique_dist(insanitylevel) and bool(imagetypelist): + if(unique_dist(insanitylevel) and bool(imagetypelist)): completeprompt += "-imagetype-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - step = step + 1 + step = step + 1 # start unique art here - if uniqueartmode == True: + if(uniqueartmode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(othertypelist): + if(uncommon_dist(insanitylevel) and bool(othertypelist)): completeprompt += "-othertype-, " - if uncommon_dist(insanitylevel) and bool(artmovementlist): + if(uncommon_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if uncommon_dist(insanitylevel) and bool(colorschemelist): + if(uncommon_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if rare_dist(insanitylevel) and bool(lightinglist): + if(rare_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if unique_dist(insanitylevel) and bool(imagetypelist): + if(unique_dist(insanitylevel) and bool(imagetypelist)): completeprompt += "-imagetype-, " - if unique_dist(insanitylevel) and bool(qualitylist): + if(unique_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - - step = step + 1 + + step = step + 1 # start quality vomit here - if qualityvomitmode == True: + if(qualityvomitmode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(vomitlist): + if(uncommon_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if uncommon_dist(insanitylevel) and bool(qualitylist): + if(uncommon_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - if unique_dist(insanitylevel) and bool(minivomitlist): + if(unique_dist(insanitylevel) and bool(minivomitlist)): completeprompt += "-minivomit-, " - if unique_dist(insanitylevel) and bool(artmovementlist): + if(unique_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " step = step + 1 # start mood color here - if colorcannonmode == True: + if(colorcannonmode == True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(moodlist): + if(uncommon_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if uncommon_dist(insanitylevel) and bool(colorschemelist): + if(uncommon_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if unique_dist(insanitylevel) and bool(artmovementlist): + if(unique_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(lightinglist): + if(unique_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - step = step + 1 + step = step + 1 # start photo fantasy here - if photofantasymode == True: + if(photofantasymode == True): step = 0 end = random.randint(1, insanitylevel) + 1 - if common_dist(insanitylevel): - if uncommon_dist(insanitylevel): + if(common_dist(insanitylevel)): + if(uncommon_dist(insanitylevel)): completeprompt += "-imagetypequality- " completeprompt += " photograph, " while step < end: - if uncommon_dist(insanitylevel) and bool(lightinglist): + if(uncommon_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-photoaddition-, " - if uncommon_dist(insanitylevel) and bool(lightinglist): + if(uncommon_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if uncommon_dist(insanitylevel) and bool(cameralist): + if(uncommon_dist(insanitylevel) and bool(cameralist)): completeprompt += "-camera-, " - if rare_dist(insanitylevel) and bool(lenslist): + if(rare_dist(insanitylevel) and bool(lenslist)): completeprompt += "-lens-, " - if unique_dist(insanitylevel) and bool(moodlist): + if(unique_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - step = step + 1 + step = step + 1 # start massive madness here - if massivemadnessmode == True: + if(massivemadnessmode == True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if rare_dist(insanitylevel) and bool(artistlist): + if(rare_dist(insanitylevel) and bool(artistlist)): completeprompt += "-artist-, " - if rare_dist(insanitylevel) and bool(descriptorlist): + if(rare_dist(insanitylevel) and bool(descriptorlist)): completeprompt += "-descriptor-, " - if rare_dist(insanitylevel) and bool(moodlist): + if(rare_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if rare_dist(insanitylevel) and bool(colorschemelist): + if(rare_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if rare_dist(insanitylevel) and bool(artmovementlist): + if(rare_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if rare_dist(insanitylevel) and bool(lightinglist): + if(rare_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if rare_dist(insanitylevel) and bool(minilocationadditionslist): + if(rare_dist(insanitylevel) and bool(minilocationadditionslist)): completeprompt += "-minilocationaddition-, " - if rare_dist(insanitylevel) and bool(materiallist): + if(rare_dist(insanitylevel) and bool(materiallist)): completeprompt += "-material-, " - if rare_dist(insanitylevel) and bool(conceptsuffixlist): + if(rare_dist(insanitylevel) and bool(conceptsuffixlist)): completeprompt += "-conceptsuffix-, " - if rare_dist(insanitylevel) and bool(qualitylist): + if(rare_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - if rare_dist(insanitylevel) and bool(cameralist): + if(rare_dist(insanitylevel) and bool(cameralist)): completeprompt += "-camera-, " - if rare_dist(insanitylevel) and bool(lenslist): + if(rare_dist(insanitylevel) and bool(lenslist)): completeprompt += "-lens-, " - if rare_dist(insanitylevel) and bool(imagetypelist): + if(rare_dist(insanitylevel) and bool(imagetypelist)): completeprompt += "-imagetype-, " - step = step + 1 + step = step + 1 + - # start styles mode here - if stylesmode == True: + + # start styles mode here + if(stylesmode == True): chosenstyle = random.choice(styleslist) chosenstyleprefix = chosenstyle.split("-subject-")[0] - chosenstylesuffix = chosenstyle.split("-subject-")[1] + chosenstylesuffix= chosenstyle.split("-subject-")[1] completeprompt += chosenstyleprefix + + # start artist part + artistsplacement = "front" # remove the artistsatbackchange to be depended on the insanitylevel, we would like this to be a set chance - if random.randint(0, 2) == 0 and onlyartists == False: + if(random.randint(0, 2) == 0 and onlyartists == False): artistlocations = ["back", "middle"] artistsplacement = random.choice(artistlocations) - if artists != "none" and artistsplacement == "front" and generateartist == True: + if(artists != "none" and artistsplacement == "front" and generateartist == True): doartistnormal = True - if artists == "greg mode": + if(artists == "greg mode"): artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode-, " doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif originalartistchoice == "all" and random.randint(0, 3) == 0: - if mainchooser in ["humanoid", "animal"]: + elif(originalartistchoice == "all" and random.randint(0,3) == 0): + if(mainchooser in ["humanoid", "animal"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif mainchooser in ["landscape"]: + elif(mainchooser in ["landscape"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif subjectchooser in ["building"]: + elif(subjectchooser in ["building"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False # else sometimes to something like this? - elif random.randint(0, 5) == 0: + elif(random.randint(0,5) == 0): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-), OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-) and OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-)" - ) + completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-), OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-) and OR(-portraitartist-;-characterartist-;-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-)" doartistnormal = False - if doartistnormal: + + + if(doartistnormal): + # take 1-3 artists, weighted to 1-2 step = random.randint(0, 1) minstep = step end = random.randint(1, insanitylevel3) + + + # determine artist mode: # normal # hybrid | @@ -1912,48 +1438,41 @@ def build_dynamic_prompt( # stopping at step x ::X # enhancing from step x - modeselector = random.randint(0, 10) - if modeselector < 5 and end - step >= 2: - artistmodeslist = [ - "hybrid", - "stopping", - "adding", - "switching", - "enhancing", - ] - artistmode = artistmodeslist[modeselector] - if advancedprompting == False: - artistmode = "normal" - if artistmode in ["hybrid", "switching"] and end - step == 1: - artistmode = "normal" - if onlyartists == True and artistmode == "enhancing": + + + modeselector = random.randint(0,10) + if modeselector < 5 and end - step >= 2: + artistmodeslist = ["hybrid", "stopping", "adding", "switching", "enhancing"] + artistmode = artistmodeslist[modeselector] + if(advancedprompting == False): + artistmode = "normal" + if (artistmode in ["hybrid","switching"] and end - step == 1): + artistmode = "normal" + + if(onlyartists == True and artistmode == "enhancing"): artistmode = "normal" # if there are not enough artists in the list, then just go normal - if len(artistlist) < 3: + if(len(artistlist) < 3): artistmode = "normal" - if onlyartists == True and step == end: + if(onlyartists == True and step == end): step = step - 1 - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + if artistmode in ["hybrid", "stopping", "adding","switching"]: completeprompt += " [" - - while step < end: - if normal_dist(insanitylevel): + + while step < end: + if(normal_dist(insanitylevel)): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if step == minstep: + #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if(step == minstep): # sometimes do this - if ( - giventypeofimage == "" - and imagetype == "all" - and random.randint(0, 1) == 0 - ): - if artiststyleselectormode == "normal": + if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): + if(artiststyleselectormode == "normal"): completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -1961,287 +1480,166 @@ def build_dynamic_prompt( else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ( - ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" - ) - + completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if artistmode not in ["hybrid", "switching"] and not end - step > 1: + + if artistmode not in ["hybrid", "switching"]and not end - step > 1: completeprompt += "," - elif ( - artistmode not in ["hybrid", "switching"] - and not end - step == 1 - ): + elif artistmode not in ["hybrid", "switching"]and not end - step == 1: completeprompt += " and " - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1, 19)) - - if artistmode in ["switching", "adding"]: - completeprompt += ":" + str(random.randint(1, 18)) - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + completeprompt += str(random.randint(1,19)) + + if artistmode in ["switching","adding"]: + completeprompt += ":" + str(random.randint(1,18)) + if artistmode in ["hybrid", "stopping","adding", "switching"]: completeprompt += "] " - if onlyartists == True: - # Parse or statements + + if(onlyartists == True): + #Parse or statements completeprompt = parse_custom_functions(completeprompt, insanitylevel) # replace artist wildcards - completeprompt = replacewildcard( - completeprompt, insanitylevel, "-artist-", artistlist, False, False - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-gregmode-", - gregmodelist, - False, - False, - ) - - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-fantasyartist-", - fantasyartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-popularartist-", - popularartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-romanticismartist-", - romanticismartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-photographyartist-", - photographyartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-portraitartist-", - portraitartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-characterartist-", - characterartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-landscapeartist-", - landscapeartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-scifiartist-", - scifiartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-graphicdesignartist-", - graphicdesignartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-digitalartist-", - digitalartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-architectartist-", - architectartistlist, - False, - False, - ) - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - "-cinemaartist-", - cinemaartistlist, - False, - False, - ) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-artist-", artistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-gregmode-", gregmodelist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-fantasyartist-", fantasyartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-popularartist-", popularartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-romanticismartist-", romanticismartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-photographyartist-", photographyartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-portraitartist-", portraitartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-characterartist-", characterartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-landscapeartist-", landscapeartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-scifiartist-", scifiartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-graphicdesignartist-", graphicdesignartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-digitalartist-", digitalartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-architectartist-", architectartistlist, False, False) + completeprompt = replacewildcard(completeprompt, insanitylevel, "-cinemaartist-", cinemaartistlist, False, False) + # clean it up - completeprompt = cleanup( - completeprompt, advancedprompting, insanitylevel - ) + completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) print("only generated these artists:" + completeprompt) return completeprompt + completeprompt += ", " + # sometimes do this as well - if ( - giventypeofimage == "" - and imagetype == "all" - and random.randint(0, 2) == 0 - ): + if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 2) == 0): completeprompt += "-artiststyle- art, " + if artistmode in ["enhancing"]: completeprompt += " [" + + # start image type - if giventypeofimage == "" and generatetype == True: - 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": + if(giventypeofimage=="" and generatetype == True): + 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 += random.choice(othertypelist) - - if ( - imagetype == "all" - and chance_roll(insanitylevel, imagetypechance) - and amountofimagetypes <= 1 - ): + + if(imagetype == "all" and chance_roll(insanitylevel, imagetypechance) and amountofimagetypes <= 1): amountofimagetypes = 1 + + for i in range(amountofimagetypes): - # one in 6 images is a complex/other type - if ( - chance_roll(insanitylevel, imagetypequalitychance) - or originalartistchoice == "greg mode" - ) and generateimagetypequality: + # one in 6 images is a complex/other type + if((chance_roll(insanitylevel, imagetypequalitychance) or originalartistchoice == "greg mode") and generateimagetypequality): completeprompt += "-imagetypequality- " - # if("photography" in artiststyleselector - # or "photography" in artists): - # completeprompt += " photograph, " - # elif("portrait" in artiststyleselector - # or "portrait" in artists): - # completeprompt += " portrait, " - # if("landscape" in artiststyleselector - # or "landscape" in artists): - # completeprompt += " landscape, " + # if("photography" in artiststyleselector + # or "photography" in artists): + # completeprompt += " photograph, " + # elif("portrait" in artiststyleselector + # or "portrait" in artists): + # completeprompt += " portrait, " + # if("landscape" in artiststyleselector + # or "landscape" in artists): + # completeprompt += " landscape, " - # woops, never to this as wildcards. We need to know as early as possible wether something is a photo. Lets put it back! - elif random.randint(0, 5) < 5: + # woops, never to this as wildcards. We need to know as early as possible wether something is a photo. Lets put it back! + elif(random.randint(0,5) < 5): completeprompt += " " + random.choice(imagetypelist) + ", " else: othertype = 1 completeprompt += " " + random.choice(othertypelist) + ", " - - if othertype == 1: + + if(othertype==1): completeprompt += " of a " else: completeprompt += ", " - elif generatetype == True: + elif(generatetype == True): othertype = 1 completeprompt += giventypeofimage + " of a " - ### here we can do some other stuff to spice things up - if ( - chance_roll(insanitylevel, minilocationadditionchance) - and generateminilocationaddition == True - ): - completeprompt += " -minilocationaddition-, " - if ( - chance_roll(insanitylevel, artmovementprefixchance) - and generateartmovement == True - ): + + ### here we can do some other stuff to spice things up + if(chance_roll(insanitylevel, minilocationadditionchance) and generateminilocationaddition == True): + completeprompt += " -minilocationaddition-, " + + if(chance_roll(insanitylevel, artmovementprefixchance) and generateartmovement == True): generateartmovement = False completeprompt += " -artmovement-, " - - if ( - chance_roll(insanitylevel, minivomitprefix1chance) - and generateminivomit == True - ): + + if(chance_roll(insanitylevel, minivomitprefix1chance) and generateminivomit == True): + completeprompt += " -minivomit-, " + + if(chance_roll(insanitylevel, minivomitprefix2chance) and generateminivomit == True): completeprompt += " -minivomit-, " - if ( - chance_roll(insanitylevel, minivomitprefix2chance) - and generateminivomit == True - ): - completeprompt += " -minivomit-, " + # start shot size - if ( - mainchooser in ["object", "animal", "humanoid", "concept"] - and othertype == 0 - and "portrait" not in completeprompt - and generateshot == True - and chance_roll(insanitylevel, shotsizechance) - ): + if(mainchooser in ["object", "animal", "humanoid", "concept"] and othertype == 0 and "portrait" not in completeprompt and generateshot == True and chance_roll(insanitylevel,shotsizechance)): completeprompt += "-shotsize- of a " - elif "portrait" in completeprompt and generateshot == True: + elif("portrait" in completeprompt and generateshot == True): completeprompt += " ,close up of a " - elif mainchooser in ["landscape"] and generateshot == True: + elif(mainchooser in ["landscape"] and generateshot == True): completeprompt += " landscape of a " - elif generateshot == True: + elif(generateshot == True): completeprompt += ", " - + genjoboractivity = False # start subject building - if generatesubject == True: - # start with descriptive qualities + + # divider between subject and everything else + completeprompt += " @ " + + if(generatesubject == True): + # start with descriptive qualities + + + + if(subjectingivensubject): + completeprompt += " " + givensubjectpromptlist[0] + " " # Once in a very rare while, we get a ... full of ...s - if novel_dist(insanitylevel) and subjectchooser in [ - "animal", - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "firstname", - ]: + if(novel_dist(insanitylevel) and subjectchooser in ["animal", "animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","firstname"]): buildingfullmode = True insideshot = 1 heshelist = ["they"] @@ -2249,136 +1647,70 @@ def build_dynamic_prompt( himherlist = ["them"] completeprompt += "a OR(-building-;-location-;-waterlocation-;-container-;rare) full of " + # Sometimes the descriptors are at the back, in more natural language. Lets determine. - descriptorsintheback = random.randint(0, 2) - if descriptorsintheback < 2: + descriptorsintheback = random.randint(0,2) + if(descriptorsintheback < 2): # Common to have 1 description, uncommon to have 2 - if ( - chance_roll(insanitylevel, subjectdescriptor1chance) - and generatedescriptors == True - ): - if subjectchooser in [ - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ]: + if(chance_roll(insanitylevel, subjectdescriptor1chance) and generatedescriptors == True): + if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"]): completeprompt += "-humandescriptor- " - elif mainchooser == "landscape": + elif(mainchooser == "landscape"): completeprompt += "-locationdescriptor- " - elif mainchooser == "animal": + elif(mainchooser == "animal"): completeprompt += "-animaldescriptor- " else: completeprompt += "-descriptor- " - if ( - chance_roll(insanitylevel, subjectdescriptor2chance) - and generatedescriptors == True - ): - if subjectchooser in [ - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ]: + if(chance_roll(insanitylevel, subjectdescriptor2chance) and generatedescriptors == True): + if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"]): completeprompt += "-humandescriptor- " - elif mainchooser == "landscape": + elif(mainchooser == "landscape"): completeprompt += "-locationdescriptor- " - elif mainchooser == "animal": + elif(mainchooser == "animal"): completeprompt += "-animaldescriptor- " else: completeprompt += "-descriptor- " - + # color, for animals, landscape, objects and concepts - if mainchooser in [ - "animal", - "object", - "landscape", - "concept", - ] and unique_dist(insanitylevel): + if(mainchooser in ["animal", "object", "landscape", "concept"] and unique_dist(insanitylevel)): completeprompt += " OR(-color-;-colorcombination-) " - + # age, very rare to add. - if subjectchooser in [ - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] and extraordinary_dist(insanitylevel): - completeprompt += str(random.randint(20, 99)) + " OR(y.o.;year old) " + if(subjectchooser in ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and extraordinary_dist(insanitylevel)): + completeprompt += str(random.randint(20,99)) + " OR(y.o.;year old) " - if ( - subjectchooser - in [ - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, subjectbodytypechance) - and generatebodytype == True - ): + if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, subjectbodytypechance) and generatebodytype == True): completeprompt += "-bodytype- " - if ( - subjectchooser - in [ - "object", - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, subjectculturechance) - and generatedescriptors == True - ): + if(subjectchooser in ["object","animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, subjectculturechance) and generatedescriptors == True): completeprompt += "-culture- " - if mainchooser == "object": + if(mainchooser == "object"): # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" # if we have an overwrite, then make sure we only take the override - if subtypeobject != "all": - if subtypeobject == "generic objects": + if(subtypeobject != "all"): + if(subtypeobject == "generic objects"): objectwildcardlist = ["-object-"] - if subtypeobject == "vehicles": + if(subtypeobject == "vehicles"): objectwildcardlist = ["-vehicle-"] - if subtypeobject == "food": + if(subtypeobject == "food"): objectwildcardlist = ["-food-"] - if subtypeobject == "buildings": + if(subtypeobject == "buildings"): objectwildcardlist = ["-building-"] - if subtypeobject == "space": + if(subtypeobject == "space"): objectwildcardlist = ["-space-"] - if subtypeobject == "flora": + if(subtypeobject == "flora"): objectwildcardlist = ["-flora-"] - + # if we have a given subject, we should skip making an actual subject - if givensubject == "": - if rare_dist(insanitylevel) and advancedprompting == True: + # unless we have "subject" in the given subject + + + if(givensubject == "" or (subjectingivensubject and givensubject != "")): + + if(rare_dist(insanitylevel) and advancedprompting == True): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" @@ -2387,433 +1719,296 @@ def build_dynamic_prompt( completeprompt += chosenobjectwildcard + " " - if hybridorswap == "hybrid": - if uncommon_dist(insanitylevel): - completeprompt += ( - "|" + random.choice(objectwildcardlist) + "] " - ) + if(hybridorswap == "hybrid"): + if(uncommon_dist(insanitylevel)): + completeprompt += "|" + random.choice(objectwildcardlist) + "] " else: - completeprompt += "|" + completeprompt += "|" completeprompt += chosenobjectwildcard + " " completeprompt += "] " - if hybridorswap == "swap": - if uncommon_dist(insanitylevel): - completeprompt += ( - ":" - + random.choice(objectwildcardlist) - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "swap"): + if(uncommon_dist(insanitylevel)): + completeprompt += ":" + random.choice(objectwildcardlist) + ":" + str(random.randint(1,5)) + "] " else: completeprompt += ":" completeprompt += chosenobjectwildcard + " " - completeprompt += ":" + str(random.randint(1, 5)) + "] " + completeprompt += ":" + str(random.randint(1,5)) + "] " else: completeprompt += " " + givensubject + " " - + hybridorswap = "" - if mainchooser == "animal": + if(mainchooser == "animal"): # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - + # if we have a given subject, we should skip making an actual subject - if givensubject == "": - if rare_dist(insanitylevel) and advancedprompting == True: + if(givensubject == "" or (subjectingivensubject and givensubject != "")): + + if(rare_dist(insanitylevel) and advancedprompting == True): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - - if unique_dist(insanitylevel) and generateanimaladdition == True: + + if(unique_dist(insanitylevel) and generateanimaladdition == True): animaladdedsomething = 1 completeprompt += "-animaladdition- -animal- " - if animaladdedsomething != 1: + if(animaladdedsomething != 1): completeprompt += "-animal- " - if hybridorswap == "hybrid": - if uncommon_dist(insanitylevel): + + + if(hybridorswap == "hybrid"): + if(uncommon_dist(insanitylevel)): completeprompt += "|" + random.choice(hybridlist) + "] " else: completeprompt += "| -animal- ] " - if hybridorswap == "swap": - if uncommon_dist(insanitylevel): - completeprompt += ( - ":" - + random.choice(hybridlist) - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "swap"): + if(uncommon_dist(insanitylevel)): + completeprompt += ":" + random.choice(hybridlist) + ":" + str(random.randint(1,5)) + "] " else: - completeprompt += ( - ":-animal-:" + str(random.randint(1, 5)) + "] " - ) + completeprompt += ":-animal-:" + str(random.randint(1,5)) + "] " else: completeprompt += " " + givensubject + " " - + hybridorswap = "" - # move job or activity logic here. We want to place it at 2 different places maybe - - if ( - subjectchooser - in [ - "animal as human", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, joboractivitychance) - and humanspecial != 1 - and generatesubject == True - ): + # move job or activity logic here. We want to place it at 2 different places maybe + + if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation", "manwomanmultiple","firstname"] and chance_roll(insanitylevel, joboractivitychance) and humanspecial != 1 and generatesubject == True): genjoboractivity = True - genjoboractivitylocationslist = [ - "front", - "middle", - "middle", - "back", - "back", - "back", - ] + genjoboractivitylocationslist = ["front","middle", "middle","back","back", "back"] genjoboractivitylocation = random.choice(genjoboractivitylocationslist) + - if genjoboractivity and genjoboractivitylocation == "front": + if(genjoboractivity and genjoboractivitylocation=="front"): completeprompt += "-job- " - + + # if we have a given subject, we should skip making an actual subject - if mainchooser == "humanoid": + if(mainchooser == "humanoid"): # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - if givensubject == "": - if subjectchooser == "human": - completeprompt += "-manwoman-" + if(givensubject == "" or (subjectingivensubject and givensubject != "")): - if subjectchooser == "manwomanrelation": + if(subjectchooser == "human"): + completeprompt += "-manwoman-" + + if(subjectchooser == "manwomanrelation"): completeprompt += "-manwomanrelation-" - if subjectchooser == "manwomanmultiple": + if(subjectchooser == "manwomanmultiple"): completeprompt += "-manwomanmultiple-" - if subjectchooser == "job": + if(subjectchooser == "job"): completeprompt += "-malefemale- " completeprompt += "-job-" - if subjectchooser == "fictional": - if ( - rare_dist(insanitylevel) - and advancedprompting == True - and buildingfullmode == False - ): + if(subjectchooser == "fictional"): + if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + # Sometimes, we do a gender swap. Much fun! - if novel_dist(insanitylevel): + if(novel_dist(insanitylevel)): completeprompt += gender + " version of -oppositefictional-" else: completeprompt += "-fictional-" - if hybridorswap == "hybrid": - completeprompt += ( - "|" + random.choice(hybridhumanlist) + " ] " - ) - if hybridorswap == "swap": - completeprompt += ( - ":" - + random.choice(hybridhumanlist) - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "hybrid"): + completeprompt += "|" + random.choice(hybridhumanlist) + " ] " + if(hybridorswap == "swap"): + completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " hybridorswap = "" - if subjectchooser == "non fictional": - if ( - rare_dist(insanitylevel) - and advancedprompting == True - and buildingfullmode == False - ): + if(subjectchooser == "non fictional"): + if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" # Sometimes, we do a gender swap. Much fun! - if novel_dist(insanitylevel): - completeprompt += ( - gender + " version of -oppositenonfictional-" - ) + if(novel_dist(insanitylevel)): + completeprompt += gender + " version of -oppositenonfictional-" else: completeprompt += "-nonfictional-" - if hybridorswap == "hybrid": - completeprompt += ( - "|" + random.choice(hybridhumanlist) + "] " - ) - if hybridorswap == "swap": - completeprompt += ( - ":" - + random.choice(hybridhumanlist) - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "hybrid"): + completeprompt += "|" + random.choice(hybridhumanlist) + "] " + if(hybridorswap == "swap"): + completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " hybridorswap = "" - if subjectchooser == "humanoid": - if gender != "all": + if(subjectchooser == "humanoid"): + if(gender != "all"): completeprompt += "-malefemale- " - if ( - rare_dist(insanitylevel) - and advancedprompting == True - and buildingfullmode == False - ): + if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-humanoid-" - if hybridorswap == "hybrid": - completeprompt += ( - "|" + random.choice(hybridhumanlist) + "] " - ) - if hybridorswap == "swap": - completeprompt += ( - ":" - + random.choice(hybridhumanlist) - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "hybrid"): + completeprompt += "|" + random.choice(hybridhumanlist) + "] " + if(hybridorswap == "swap"): + completeprompt += ":" + random.choice(hybridhumanlist) + ":" + str(random.randint(1,5)) + "] " hybridorswap = "" - if subjectchooser == "firstname": - if ( - rare_dist(insanitylevel) - and advancedprompting == True - and buildingfullmode == False - ): + if(subjectchooser == "firstname"): + if(rare_dist(insanitylevel) and advancedprompting == True and buildingfullmode == False): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-firstname-" - if hybridorswap == "hybrid": + if(hybridorswap == "hybrid"): completeprompt += "|" + "-firstname-" + "] " - if hybridorswap == "swap": - completeprompt += ( - ":" - + "-firstname-" - + ":" - + str(random.randint(1, 5)) - + "] " - ) + if(hybridorswap == "swap"): + completeprompt += ":" + "-firstname-" + ":" + str(random.randint(1,5)) + "] " hybridorswap = "" - if buildingfullmode == True: + if(buildingfullmode == True): completeprompt += "s" completeprompt += " " else: - if ( - subjectchooser == "manwomanmultiple" - and subtypehumanoid != "multiple humans" - and givensubject not in ["1girl", "1boy", "solo"] - ): - if random.randint(0, 1) == 1: - completeprompt += ( - " " + givensubject + " and a -manwomanmultiple- " - ) + if(subjectchooser == "manwomanmultiple" and subtypehumanoid != "multiple humans" and givensubject not in ["1girl", "1boy", "solo"]): + if(random.randint(0,1) == 1): + completeprompt += " " + givensubject + " and a -manwomanmultiple- " else: - completeprompt += ( - " a OR(group;couple;crowd;bunch) of " - + givensubject - + " " - ) + completeprompt += " a OR(group;couple;crowd;bunch) of " + givensubject + " " else: - completeprompt += " " + givensubject + " " - - # sometimes add a suffix for more fun! - if ( - mainchooser == "humanoid" - or mainchooser == "animal" - or mainchooser == "object" - ) and chance_roll(insanitylevel, subjectconceptsuffixchance): + completeprompt += " " + givensubject + " " + + + # sometimes add a suffix for more fun! + if( (mainchooser == "humanoid" or mainchooser == "animal" or mainchooser == "object") and chance_roll(insanitylevel, subjectconceptsuffixchance)): completeprompt += " of -conceptsuffix- " - if ( - mainchooser == "humanoid" - or mainchooser == "animal" - or mainchooser == "object" - ): - # completion of strenght end - completeprompt += "-objectstrengthend-" - - if mainchooser == "animal" and legendary_dist(insanitylevel): + if(mainchooser == "humanoid" or mainchooser == "animal" or mainchooser == "object"): + # completion of strenght end + completeprompt += "-objectstrengthend-" + + if(mainchooser == 'animal' and legendary_dist(insanitylevel)): animaladdedsomething = 1 completeprompt += " -animalsuffixaddition- " - - if subjectchooser == "landscape": + + + if(subjectchooser == "landscape"): # first add a wildcard that can be used to create prompt strenght completeprompt += " -objectstrengthstart-" - + # if we have a given subject, we should skip making an actual subject - if givensubject == "": - if rare_dist(insanitylevel) and advancedprompting == True: + if(givensubject == "" or (subjectingivensubject and givensubject != "")): + if(rare_dist(insanitylevel) and advancedprompting == True): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) completeprompt += "[" - + completeprompt += "-location- " - if hybridorswap == "hybrid": - completeprompt += "|" + "-location-" + "] " - if hybridorswap == "swap": - completeprompt += ( - ":" + "-location-" + ":" + str(random.randint(1, 5)) + "] " - ) + if(hybridorswap == "hybrid"): + completeprompt += "|" + "-location-" + "] " + if(hybridorswap == "swap"): + completeprompt += ":" + "-location-" + ":" + str(random.randint(1,5)) + "] " else: - completeprompt += " " + givensubject + " " - + completeprompt += " " + givensubject + " " + hybridorswap = "" # completion of strenght end completeprompt += "-objectstrengthend-" # shots from inside can create cool effects in landscapes - if ( - chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) - and insideshot == 0 - ): + if(chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) and insideshot == 0): insideshot = 1 # lets cheat a bit here, we can do something cool I saw on reddit - if mainchooser == "humanoid" and legendary_dist(insanitylevel): + if(mainchooser=="humanoid" and legendary_dist(insanitylevel)): completeprompt += " looking at a -addontolocationinside- " - elif mainchooser == "humanoid" and legendary_dist(insanitylevel): + elif(mainchooser=="humanoid" and legendary_dist(insanitylevel)): completeprompt += " facing a -addontolocationinside- " - elif legendary_dist(insanitylevel): - completeprompt += ( - " in the distance there is a -addontolocationinside- " - ) + elif(legendary_dist(insanitylevel)): + completeprompt += " in the distance there is a -addontolocationinside- " else: completeprompt += " from inside of a -addontolocationinside- " - if ( - chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) - and insideshot == 0 - ): + if(chance_roll(insanitylevel, subjectlandscapeaddonlocationchance) and insideshot == 0): completeprompt += " and " - if chance_roll( - insanitylevel, subjectlandscapeaddonlocationdescriptorchance - ): - completeprompt += "-locationdescriptor- " - if chance_roll( - insanitylevel, subjectlandscapeaddonlocationculturechance - ): + if(chance_roll(insanitylevel, subjectlandscapeaddonlocationdescriptorchance)): + completeprompt += "-locationdescriptor- " + if(chance_roll(insanitylevel, subjectlandscapeaddonlocationculturechance)): completeprompt += "-culture- " - # addontolocation = [locationlist,buildinglist, vehiclelist] + #addontolocation = [locationlist,buildinglist, vehiclelist] completeprompt += "-addontolocation- " - if mainchooser == "concept": + + if(mainchooser == "concept"): # first add a wildcard that can be used to create prompt strenght - completeprompt += " -objectstrengthstart-" - if givensubject == "": - if subjectchooser == "event": - completeprompt += ' "' + random.choice(eventlist) + '" ' + completeprompt += " -objectstrengthstart- " + if(givensubject == "" or (subjectingivensubject and givensubject != "")): + if(subjectchooser == "event"): + completeprompt += " \"" + random.choice(eventlist) + "\" " + + if(subjectchooser == "concept"): + completeprompt += " \"The -conceptprefix- of -conceptsuffix-\" " - if subjectchooser == "concept": - completeprompt += ' " The -conceptprefix- of -conceptsuffix- " ' + if(subjectchooser == "poemline"): + completeprompt += " \"-poemline-\" " - if subjectchooser == "poemline": - completeprompt += ' " -poemline- " ' + if(subjectchooser == "songline"): + completeprompt += " \"-songline-\" " - if subjectchooser == "songline": - completeprompt += ' " -songline- " ' + if(subjectchooser == "cardname"): + completeprompt += " \"-cardname-\" " - if subjectchooser == "cardname": - completeprompt += ' " -cardname- " ' - - if subjectchooser == "episodetitle": - completeprompt += ' " -episodetitle- " ' + if(subjectchooser == "episodetitle"): + completeprompt += " \"-episodetitle-\" " + # making subject override work with X and Y concepts, much fun! - elif givensubject != "" and subjectchooser == "concept": - if random.randint(0, 3) == 0: - completeprompt += ( - ' " The -conceptprefix- of ' + givensubject + ' " ' - ) - else: - completeprompt += ( - ' " The ' + givensubject + ' of -conceptsuffix- " ' - ) + elif(givensubject != "" and subjectchooser == "concept" and subjectingivensubject == False): + if(random.randint(0,3) == 0): + completeprompt += " \"The -conceptprefix- of " + givensubject + "\" " + else: + completeprompt += " \"The " + givensubject + " of -conceptsuffix-\" " else: - completeprompt += " " + givensubject + " " + completeprompt += " " + givensubject + " " # completion of strenght end - completeprompt += "-objectstrengthend-" + completeprompt += " -objectstrengthend-" - if genjoboractivity and genjoboractivitylocation == "middle": - joboractivitylist = [joblist, humanactivitylist] + if(subjectingivensubject): + completeprompt += " " + givensubjectpromptlist[1] + " " + + if(genjoboractivity and genjoboractivitylocation=="middle"): + joboractivitylist = [joblist,humanactivitylist] completeprompt += random.choice(random.choice(joboractivitylist)) + ", " - - if descriptorsintheback == 2: + + if(descriptorsintheback == 2): # Common to have 1 description, uncommon to have 2 - if ( - chance_roll(insanitylevel, subjectdescriptor1chance) - and generatedescriptors == True - ): - if subjectchooser in [ - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ]: - if random.randint(0, 3) > 0: + if(chance_roll(insanitylevel, subjectdescriptor1chance) and generatedescriptors == True): + if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"]): + if(random.randint(0,3) > 0): completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -humandescriptor- " - elif subjectchooser == "manwomanmultiple": + elif(subjectchooser == "manwomanmultiple"): completeprompt += ", the -samehumansubject- are OR(;very;rare) -humandescriptor-" else: completeprompt += ", OR(the -manwoman-;-samehumansubject-) is OR(;very;rare) -humandescriptor-" - elif mainchooser == "landscape": + elif(mainchooser == "landscape"): completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -locationdescriptor- " - elif mainchooser == "animal": + elif(mainchooser == "animal"): completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -animaldescriptor- " else: - completeprompt += ( - ", OR(;-heshe- is;normal) OR(;very;rare) -descriptor- " - ) + completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -descriptor- " - if ( - chance_roll(insanitylevel, subjectdescriptor2chance) - and generatedescriptors == True - ): - if subjectchooser in [ - "animal as human,", - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ]: + if(chance_roll(insanitylevel, subjectdescriptor2chance) and generatedescriptors == True): + if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"]): completeprompt += " and -humandescriptor- " - elif mainchooser == "landscape": + elif(mainchooser == "landscape"): completeprompt += " and -locationdescriptor- " - elif mainchooser == "animal": + elif(mainchooser == "animal"): completeprompt += " and -animaldescriptor- " else: completeprompt += " and -descriptor- " @@ -2821,289 +2016,153 @@ def build_dynamic_prompt( # object additions for i in range(objectadditionsrepeats): - if ( - mainchooser == "object" - and chance_roll(insanitylevel, objectadditionschance) - and generateobjectaddition == True - ): + if(mainchooser == "object" and chance_roll(insanitylevel, objectadditionschance) and generateobjectaddition == True): completeprompt += ", -objectaddition- , " - + + # riding an animal, holding an object or driving a vehicle, rare - if ( - subjectchooser - in [ - "animal as human,", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, humanadditionchance) - and generatehumanaddition == True - ): + if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, humanadditionchance) and generatehumanaddition == True): humanspecial = 1 completeprompt += "-humanaddition- " - + completeprompt += ", " # unique additions for all types: - if ( - chance_roll(insanitylevel, overalladditionchance) - and generateoveralladdition == True - ): + if(chance_roll(insanitylevel, overalladditionchance) and generateoveralladdition == True): completeprompt += "-overalladdition- " + + + + # SD understands emoji's. Can be used to manipulate facial expressions. # emoji, legendary - if ( - subjectchooser - in [ - "animal as human,", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, emojichance) - and generateemoji == True - ): + if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, emojichance) and generateemoji== True): completeprompt += "-emoji-, " # human expressions - if ( - subjectchooser - in [ - "animal as human,", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, humanexpressionchance) - and generatehumanexpression == True - ): + if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple","firstname"] and chance_roll(insanitylevel, humanexpressionchance) and generatehumanexpression== True): completeprompt += "-humanexpression-, " + # cosplaying - # if(subjectchooser in ["animal as human", "non fictional", "humanoid"] and rare_dist(insanitylevel) and humanspecial != 1): + #if(subjectchooser in ["animal as human", "non fictional", "humanoid"] and rare_dist(insanitylevel) and humanspecial != 1): # completeprompt += "cosplaying as " + random.choice(fictionallist) + ", " - # Job + # Job # either go job or activity, not both - if genjoboractivity and genjoboractivitylocation == "back": - joboractivitylist = [joblist, humanactivitylist] - completeprompt += ( - ", " + random.choice(random.choice(joboractivitylist)) + ", " - ) + if(genjoboractivity and genjoboractivitylocation=="back"): + joboractivitylist = [joblist,humanactivitylist] + completeprompt += ", " + random.choice(random.choice(joboractivitylist)) + ", " + # if(subjectchooser in ["animal as human","human","job", "fictional", "non fictional", "humanoid"] and legendary_dist(insanitylevel)): # skintypelist = ["-color-", "-material-"] # completeprompt += ", with " + random.choice(skintypelist) + " skin, " # add face builder sometimes on generic humans - if ( - subjectchooser in ["human", "humanoid", "manwomanrelation", "firstname"] - and chance_roll(insanitylevel, buildfacechance) - and generateface == True - ): + if(subjectchooser in ["human", "humanoid", "manwomanrelation","firstname"] and chance_roll(insanitylevel, buildfacechance) and generateface== True): completeprompt += random.choice(buildfacelist) + ", " + + + # custom mid list for i in range(custominputmidrepeats): - if ( - chance_roll(insanitylevel, custominputmidchance) - and generatecustominputmid == True - ): + if(chance_roll(insanitylevel, custominputmidchance) and generatecustominputmid == True): completeprompt += random.choice(custominputmidlist) + ", " - + # add in some more mini vomits - if chance_roll(insanitylevel, minivomitmidchance) and generateminivomit == True: + if(chance_roll(insanitylevel, minivomitmidchance) and generateminivomit == True): completeprompt += " -minivomit-, " - + # outfit builder - if ( - subjectchooser - in [ - "animal as human", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, outfitchance) - and generateoutfit == True - and humanspecial != 1 - ): + if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, outfitchance) and generateoutfit == True and humanspecial != 1): completeprompt += " " + random.choice(buildoutfitlist) + ", " - if extraordinary_dist(insanitylevel): + if(extraordinary_dist(insanitylevel)): completeprompt += " -outfitvomit-, " - elif overrideoutfit != "" and imagetype != "only templates mode": + elif(overrideoutfit != "" and imagetype != "only templates mode"): completeprompt += " " + random.choice(buildoutfitlist) + ", " - if extraordinary_dist(insanitylevel): + if(extraordinary_dist(insanitylevel)): completeprompt += " -outfitvomit-, " + - if ( - subjectchooser - in [ - "animal as human", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, posechance) - and humanspecial != 1 - and generatepose == True - ): + + if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, posechance) and humanspecial != 1 and generatepose == True): completeprompt += random.choice(poselist) + ", " - - if ( - subjectchooser - in [ - "human", - "job", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, hairchance) - and generatehairstyle == True - ): + + if(subjectchooser in ["human","job","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, hairchance) and generatehairstyle == True): completeprompt += random.choice(buildhairlist) + ", " - if unique_dist(insanitylevel): + if(unique_dist(insanitylevel)): completeprompt += " -hairvomit-, " - if ( - subjectchooser - in [ - "animal as human,", - "human", - "fictional", - "non fictional", - "humanoid", - "manwomanrelation", - "manwomanmultiple", - "firstname", - ] - and chance_roll(insanitylevel, accessorychance) - and generateaccessorie == True - and generateaccessories == True - ): + if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid", "manwomanrelation","manwomanmultiple", "firstname"] and chance_roll(insanitylevel, accessorychance) and generateaccessorie == True and generateaccessories == True): completeprompt += random.choice(buildaccessorielist) + ", " - if ( - chance_roll(insanitylevel, humanoidinsideshotchance) - and subjectchooser not in ["landscape", "concept"] - and generateinsideshot == True - ): + if(chance_roll(insanitylevel, humanoidinsideshotchance) and subjectchooser not in ["landscape", "concept"] and generateinsideshot == True): insideshot = 1 completeprompt += random.choice(insideshotlist) + ", " - - if ( - subjectchooser not in ["landscape", "concept"] - and humanspecial != 1 - and insideshot == 0 - and chance_roll(insanitylevel, humanoidbackgroundchance) - and generatebackground == True - ): + + if(subjectchooser not in ["landscape", "concept"] and humanspecial != 1 and insideshot == 0 and chance_roll(insanitylevel, humanoidbackgroundchance) and generatebackground == True): completeprompt += random.choice(backgroundtypelist) + ", " # minilocation bit - if ( - subjectchooser in ["landscape"] - and chance_roll(insanitylevel, landscapeminilocationchance) - and generateminilocationaddition == True - ): + if(subjectchooser in ["landscape"] and chance_roll(insanitylevel, landscapeminilocationchance) and generateminilocationaddition == True): + completeprompt += " -minilocationaddition-, " + + if(chance_roll(insanitylevel, generalminilocationchance) and generateminilocationaddition == True): completeprompt += " -minilocationaddition-, " - if ( - chance_roll(insanitylevel, generalminilocationchance) - and generateminilocationaddition == True - ): - completeprompt += " -minilocationaddition-, " + + # divider between subject and everything else + completeprompt += " @ " + # Add more quality while in greg mode lol - if originalartistchoice == "greg mode" and generatequality == True: + if(originalartistchoice == "greg mode" and generatequality == True): completeprompt += "-quality-, " # landscapes it is nice to always have a time period - if chance_roll(insanitylevel, timperiodchance) or subjectchooser == "landscape": - if generatetimeperiod == True: + if(chance_roll(insanitylevel, timperiodchance) or subjectchooser=="landscape"): + if(generatetimeperiod == True): completeprompt += "-timeperiod-, " - if ( - mainchooser not in ["landscape"] - and chance_roll(insanitylevel, focuschance) - and generatefocus == True - ): + if(mainchooser not in ["landscape"] and chance_roll(insanitylevel, focuschance) and generatefocus == True): completeprompt += "-focus-, " + # artists in the middle, can happen as well: - if ( - artists != "none" - and artistsplacement == "middle" - and generateartist == True - ): + if(artists != "none" and artistsplacement == "middle" and generateartist == True): completeprompt += ", " doartistnormal = True - if artists == "greg mode": + if(artists == "greg mode"): artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode-, " doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif originalartistchoice == "all" and random.randint(0, 3) == 0: - if mainchooser in ["humanoid", "animal"]: + elif(originalartistchoice == "all" and random.randint(0,3) == 0): + if(mainchooser in ["humanoid", "animal"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif mainchooser in ["landscape"]: + elif(mainchooser in ["landscape"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif subjectchooser in ["building"]: + elif(subjectchooser in ["building"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - - if doartistnormal: + + if(doartistnormal): + # sometimes do this as well, but now in the front of the artists - if ( - giventypeofimage == "" - and imagetype == "all" - and random.randint(0, 2) == 0 - ): + if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 2) == 0): completeprompt += "-artiststyle- art, " # take 1-3 artists, weighted to 1-2 @@ -3111,6 +2170,9 @@ def build_dynamic_prompt( minstep = step end = random.randint(1, insanitylevel3) + + + # determine artist mode: # normal # hybrid | @@ -3118,37 +2180,34 @@ def build_dynamic_prompt( # adding at step x a:X # stopping at step x ::X - modeselector = random.randint(0, 10) + + modeselector = random.randint(0,10) if modeselector < 4 and end - step >= 2: artistmodeslist = ["hybrid", "stopping", "adding", "switching"] artistmode = artistmodeslist[modeselector] - if advancedprompting == False: + if(advancedprompting == False): artistmode = "normal" - if artistmode in ["hybrid", "switching"] and end - step == 1: + if artistmode in ["hybrid","switching"] and end - step == 1: artistmode = "normal" # if there are not enough artists in the list, then just go normal - if len(artistlist) < 3: + if(len(artistlist) < 3): artistmode = "normal" - - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + + if artistmode in ["hybrid", "stopping", "adding","switching"]: completeprompt += " [" - - while step < end: - if normal_dist(insanitylevel): + + while step < end: + if(normal_dist(insanitylevel)): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if step == minstep: + #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if(step == minstep): # sometimes do this - if ( - giventypeofimage == "" - and imagetype == "all" - and random.randint(0, 1) == 0 - ): - if artiststyleselectormode == "normal": + if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): + if(artiststyleselectormode == "normal"): completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -3156,320 +2215,290 @@ def build_dynamic_prompt( else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ( - ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" - ) - + completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if ( - artistmode not in ["hybrid", "switching"] - and not end - step == 1 - ): + + if artistmode not in ["hybrid", "switching"]and not end - step == 1: completeprompt += "," - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1, 19)) - - if artistmode in ["switching", "adding"]: - completeprompt += ":" + str(random.randint(1, 18)) - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + completeprompt += str(random.randint(1,19)) + + if artistmode in ["switching","adding"]: + completeprompt += ":" + str(random.randint(1,18)) + if artistmode in ["hybrid", "stopping","adding", "switching"]: completeprompt += "] " - + completeprompt += ", " # end of the artist stuff # Add more quality while in greg mode lol - if originalartistchoice == "greg mode" and generatequality == True: + if(originalartistchoice == "greg mode" and generatequality == True): completeprompt += "-quality-, " # others - if ( - chance_roll(max(1, insanitylevel - 1), directionchance) - and generatedirection == True - ): + if(chance_roll(max(1,insanitylevel -1), directionchance) and generatedirection == True): completeprompt += "-direction-, " - if chance_roll(insanitylevel, moodchance) and generatemood == True: - completeprompt += "-mood-, " + if(chance_roll(insanitylevel, moodchance) and generatemood == True): + completeprompt += "-mood-, " # add in some more mini vomits - if ( - chance_roll(insanitylevel, minivomitsuffixchance) - and generateminivomit == True - ): + if(chance_roll(insanitylevel, minivomitsuffixchance) and generateminivomit == True): completeprompt += " -minivomit-, " - - if ( - chance_roll(insanitylevel, artmovementchance) - and generateartmovement == True - ): - completeprompt += "-artmovement-, " - - if chance_roll(insanitylevel, lightingchance) and generatelighting == True: - completeprompt += "-lighting-, " + + if(chance_roll(insanitylevel, artmovementchance) and generateartmovement == True): + completeprompt += "-artmovement-, " + + if(chance_roll(insanitylevel, lightingchance) and generatelighting == True): + completeprompt += "-lighting-, " # determine wether we have a photo or not - if "photo" in completeprompt.lower(): + if("photo" in completeprompt.lower()): isphoto = 1 - - if ( - chance_roll(insanitylevel, photoadditionchance) - and isphoto == 1 - and generatephotoaddition == True - ): + + if(chance_roll(insanitylevel, photoadditionchance) and isphoto == 1 and generatephotoaddition == True): completeprompt += random.choice(photoadditionlist) + ", " + + if(isphoto == 1 and generatecamera == True): + completeprompt += "-camera-, " - if isphoto == 1 and generatecamera == True: - completeprompt += "-camera-, " - - if chance_roll(insanitylevel, lenschance) or isphoto == 1: - if generatelens == True: + if(chance_roll(insanitylevel, lenschance) or isphoto == 1): + if(generatelens == True): completeprompt += "-lens-, " - if ( - chance_roll(insanitylevel, colorschemechance) - and generatecolorscheme == True - ): + if(chance_roll(insanitylevel, colorschemechance) and generatecolorscheme == True): completeprompt += "-colorscheme-, " # vomit some cool/wierd things into the prompt - if chance_roll(insanitylevel, vomit1chance) and generatevomit == True: + if(chance_roll(insanitylevel, vomit1chance) and generatevomit == True): completeprompt += "-vomit-, " - if chance_roll(insanitylevel, vomit2chance): + if(chance_roll(insanitylevel, vomit2chance)): completeprompt += "-vomit-, " # human specfic vomit - if ( - mainchooser == "humanoid" - and chance_roll(insanitylevel, humanvomitchance) - and generatehumanvomit == True - ): + if(mainchooser == "humanoid" and chance_roll(insanitylevel, humanvomitchance) and generatehumanvomit == True): completeprompt += "-humanvomit-, " - if chance_roll(insanitylevel, humanvomitchance): + if(chance_roll(insanitylevel, humanvomitchance)): completeprompt += "-humanvomit-, " - # adding a great work of art, like starry night has cool effects. But this should happen only very rarely. - if chance_roll(insanitylevel, greatworkchance) and generategreatwork == True: + #adding a great work of art, like starry night has cool effects. But this should happen only very rarely. + if(chance_roll(insanitylevel, greatworkchance) and generategreatwork == True): completeprompt += " in the style of -greatwork-, " - # adding a poemline. But this should happen only very rarely. - if chance_roll(insanitylevel, poemlinechance) and generatepoemline == True: - completeprompt += ' "-poemline-", ' + #adding a poemline. But this should happen only very rarely. + if(chance_roll(insanitylevel, poemlinechance) and generatepoemline == True): + completeprompt += " \"-poemline-\", " - # adding a songline. But this should happen only very rarely. - if chance_roll(insanitylevel, songlinechance) and generatesongline == True: - completeprompt += ' "-songline-", ' + #adding a songline. But this should happen only very rarely. + if(chance_roll(insanitylevel, songlinechance) and generatesongline == True): + completeprompt += " \"-songline-\", " # everyone loves the adding quality. The better models don't need this, but lets add it anyway - if ( - chance_roll(insanitylevel, quality1chance) - or originalartistchoice == "greg mode" - ) and generatequality == True: + if((chance_roll(insanitylevel, quality1chance) or originalartistchoice == "greg mode") and generatequality == True): completeprompt += "-quality-, " - if ( - chance_roll(insanitylevel, quality2chance) - or originalartistchoice == "greg mode" - ): + if((chance_roll(insanitylevel, quality2chance) or originalartistchoice == "greg mode")): completeprompt += "-quality-, " + + # start second part of art blaster here - if artblastermode == True: + if(artblastermode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(artistlist): + if(uncommon_dist(insanitylevel) and bool(artistlist)): completeprompt += "-artist-, " - if uncommon_dist(insanitylevel) and bool(artmovementlist): + if(uncommon_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(vomitlist): + if(unique_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if unique_dist(insanitylevel) and bool(imagetypelist): + if(unique_dist(insanitylevel) and bool(imagetypelist)): completeprompt += "-imagetype-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - step = step + 1 - - # start second part of unique art here - if uniqueartmode == True: + step = step + 1 + + # start second part of unique art here + if(uniqueartmode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(artmovementlist): + if(uncommon_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if uncommon_dist(insanitylevel) and bool(colorschemelist): + if(uncommon_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if rare_dist(insanitylevel) and bool(lightinglist): + if(rare_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if unique_dist(insanitylevel) and bool(qualitylist): + if(unique_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - if unique_dist(insanitylevel) and bool(artistlist): + if(unique_dist(insanitylevel) and bool(artistlist)): completeprompt += "-artist-, " - if novel_dist(insanitylevel) and bool(greatworklist): + if(novel_dist(insanitylevel) and bool(greatworklist)): completeprompt += "in style of -greatwork-, " - if novel_dist(insanitylevel) and bool(poemlinelist): - completeprompt += '"-poemline-", ' - if novel_dist(insanitylevel) and bool(songlinelist): - completeprompt += '"-songline-", ' - - step = step + 1 - + if(novel_dist(insanitylevel) and bool(poemlinelist)): + completeprompt += "\"-poemline-\", " + if(novel_dist(insanitylevel) and bool(songlinelist)): + completeprompt += "\"-songline-\", " + + step = step + 1 + + # start second part of quality vomit here - if qualityvomitmode == True: + if(qualityvomitmode==True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(vomitlist): + if(uncommon_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if uncommon_dist(insanitylevel) and bool(qualitylist): + if(uncommon_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - if unique_dist(insanitylevel) and bool(minivomitlist): + if(unique_dist(insanitylevel) and bool(minivomitlist)): completeprompt += "-minivomit-, " - if unique_dist(insanitylevel) and bool(artmovementlist): + if(unique_dist(insanitylevel) and bool(artmovementlist)) : completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - step = step + 1 - + step = step + 1 + # start second part of mood color here - if colorcannonmode == True: + if(colorcannonmode == True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(moodlist): + if(uncommon_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if uncommon_dist(insanitylevel) and bool(colorschemelist): + if(uncommon_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if unique_dist(insanitylevel) and bool(artmovementlist): + if(unique_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if unique_dist(insanitylevel) and bool(lightinglist): + if(unique_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - step = step + 1 + step = step + 1 + # start second part of photo fantasy here - if photofantasymode == True: + if(photofantasymode == True): step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if uncommon_dist(insanitylevel) and bool(lightinglist): + if(uncommon_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if uncommon_dist(insanitylevel) and bool(cameralist): + if(uncommon_dist(insanitylevel) and bool(cameralist)): completeprompt += "-camera-, " - if rare_dist(insanitylevel) and bool(lenslist): + if(rare_dist(insanitylevel) and bool(lenslist)): completeprompt += "-lens-, " - if unique_dist(insanitylevel) and bool(moodlist): + if(unique_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if unique_dist(insanitylevel) and bool(colorschemelist): + if(unique_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - step = step + 1 - + step = step + 1 + # start second part of massive madness here - if massivemadnessmode == True: + if(massivemadnessmode == True): completeprompt += ", " step = 0 end = random.randint(1, insanitylevel) + 1 while step < end: - if rare_dist(insanitylevel) and bool(artistlist): + if(rare_dist(insanitylevel) and bool(artistlist)): completeprompt += "-artist-, " - if rare_dist(insanitylevel) and bool(descriptorlist): + if(rare_dist(insanitylevel) and bool(descriptorlist)): completeprompt += "-descriptor-, " - if rare_dist(insanitylevel) and bool(moodlist): + if(rare_dist(insanitylevel) and bool(moodlist)): completeprompt += "-mood-, " - if rare_dist(insanitylevel) and bool(colorschemelist): + if(rare_dist(insanitylevel) and bool(colorschemelist)): completeprompt += "-colorscheme-, " - if rare_dist(insanitylevel) and bool(vomitlist): + if(rare_dist(insanitylevel) and bool(vomitlist)): completeprompt += "-vomit-, " - if rare_dist(insanitylevel) and bool(artmovementlist): + if(rare_dist(insanitylevel) and bool(artmovementlist)): completeprompt += "-artmovement-, " - if rare_dist(insanitylevel) and bool(lightinglist): + if(rare_dist(insanitylevel) and bool(lightinglist)): completeprompt += "-lighting-, " - if rare_dist(insanitylevel) and bool(minilocationadditionslist): + if(rare_dist(insanitylevel) and bool(minilocationadditionslist)): completeprompt += "-minilocationaddition-, " - if rare_dist(insanitylevel) and bool(materiallist): + if(rare_dist(insanitylevel) and bool(materiallist)): completeprompt += "-material-, " - if rare_dist(insanitylevel) and bool(conceptsuffixlist): + if(rare_dist(insanitylevel) and bool(conceptsuffixlist)): completeprompt += "-conceptsuffix-, " - if rare_dist(insanitylevel) and bool(qualitylist): + if(rare_dist(insanitylevel) and bool(qualitylist)): completeprompt += "-quality-, " - if rare_dist(insanitylevel) and bool(cameralist): + if(rare_dist(insanitylevel) and bool(cameralist)): completeprompt += "-camera-, " - step = step + 1 + step = step + 1 # start styles mode here - if stylesmode == True: + if(stylesmode == True): completeprompt += chosenstylesuffix + # custom style list - if chance_roll(insanitylevel, customstyle1chance) and generatestyle == True: + if(chance_roll(insanitylevel, customstyle1chance) and generatestyle == True): completeprompt += "-styletilora-, " - if chance_roll(insanitylevel, customstyle2chance): + if(chance_roll(insanitylevel, customstyle2chance)): completeprompt += "-styletilora-, " + # custom suffix list for i in range(custominputsuffixrepeats): - if ( - chance_roll(insanitylevel, custominputsuffixchance) - and generatecustominputsuffix == True - ): + if(chance_roll(insanitylevel, custominputsuffixchance) and generatecustominputsuffix == True): completeprompt += random.choice(custominputsuffixlist) + ", " - if artistmode in ["enhancing"]: - completeprompt += "::" + str(random.randint(1, 17)) + "] " - if artists != "none" and artistsplacement == "back" and generateartist == True: + + if artistmode in ["enhancing"]: + completeprompt += "::" + str(random.randint(1,17)) + "] " + + + + if(artists != "none" and artistsplacement == "back" and generateartist == True): completeprompt += ", " doartistnormal = True - if artists == "greg mode": + if(artists == "greg mode"): artistbylist = ["art by", "designed by", "stylized by", "by"] completeprompt += random.choice(artistbylist) + " -gregmode- ," doartistnormal = False # in case we have ALL, we can also do a specific artist mode per chosen subject. sometimes - elif originalartistchoice == "all" and random.randint(0, 3) == 0: - if mainchooser in ["humanoid", "animal"]: + elif(originalartistchoice == "all" and random.randint(0,3) == 0): + if(mainchooser in ["humanoid", "animal"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-portraitartist-;-characterartist-), OR(-portraitartist-;-characterartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif mainchooser in ["landscape"]: + elif(mainchooser in ["landscape"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-digitalartist-), OR(-landscapeartist-;-graphicdesignartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - elif subjectchooser in ["building"]: + elif(subjectchooser in ["building"]): artistbylist = ["art by", "designed by", "stylized by", "by"] - completeprompt += ( - random.choice(artistbylist) - + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " - ) + completeprompt += random.choice(artistbylist) + " OR(-landscapeartist-;-architectartist-), OR(-landscapeartist-;-architectartist-) OR(;and OR(-fantasyartist-;-scifiartist-;-photographyartist-;-digitalartist-;-graphicdesignartist-);uncommon), " doartistnormal = False - - if doartistnormal: + + if(doartistnormal): # take 1-3 artists, weighted to 1-2 step = random.randint(0, 1) minstep = step end = random.randint(1, insanitylevel3) + + + # determine artist mode: # normal # hybrid | @@ -3477,37 +2506,34 @@ def build_dynamic_prompt( # adding at step x a:X # stopping at step x ::X - modeselector = random.randint(0, 10) + + modeselector = random.randint(0,10) if modeselector < 4 and end - step >= 2: artistmodeslist = ["hybrid", "stopping", "adding", "switching"] artistmode = artistmodeslist[modeselector] - if advancedprompting == False: + if(advancedprompting == False): artistmode = "normal" - if artistmode in ["hybrid", "switching"] and end - step == 1: + if artistmode in ["hybrid","switching"] and end - step == 1: artistmode = "normal" # if there are not enough artists in the list, then just go normal - if len(artistlist) < 3: + if(len(artistlist) < 3): artistmode = "normal" - - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + + if artistmode in ["hybrid", "stopping", "adding","switching"]: completeprompt += " [" - - while step < end: - if normal_dist(insanitylevel): + + while step < end: + if(normal_dist(insanitylevel)): isweighted = 1 - + if isweighted == 1: completeprompt += " (" - # completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") - if step == minstep: + #completeprompt = add_from_csv(completeprompt, "artists", 0, "art by ","") + if(step == minstep): # sometimes do this - if ( - giventypeofimage == "" - and imagetype == "all" - and random.randint(0, 1) == 0 - ): - if artiststyleselectormode == "normal": + if(giventypeofimage=="" and imagetype == "all" and random.randint(0, 1) == 0): + if(artiststyleselectormode == "normal"): completeprompt += artiststyleselector + " art " else: completeprompt += "-artiststyle- art " @@ -3515,798 +2541,471 @@ def build_dynamic_prompt( else: artistbylist = [""] completeprompt += random.choice(artistbylist) + " -artist-" - + if isweighted == 1: - completeprompt += ( - ":" + str(1 + (random.randint(-3, 3) / 10)) + ")" - ) - + completeprompt += ":" + str(1 + (random.randint(-3,3)/10)) + ")" + if artistmode in ["hybrid"] and not end - step == 1: completeprompt += "|" if artistmode in ["switching"] and not end - step == 1: completeprompt += ":" - - if ( - artistmode not in ["hybrid", "switching"] - and not end - step == 1 - ): + + if artistmode not in ["hybrid", "switching"]and not end - step == 1: completeprompt += "," - + isweighted = 0 - + step = step + 1 if artistmode in ["stopping"]: completeprompt += "::" - completeprompt += str(random.randint(1, 19)) - - if artistmode in ["switching", "adding"]: - completeprompt += ":" + str(random.randint(1, 18)) - if artistmode in ["hybrid", "stopping", "adding", "switching"]: + completeprompt += str(random.randint(1,19)) + + if artistmode in ["switching","adding"]: + completeprompt += ":" + str(random.randint(1,18)) + if artistmode in ["hybrid", "stopping","adding", "switching"]: completeprompt += "] " # end of the artist stuff + + + completeprompt += ", " completeprompt += suffixprompt # and then up the compounding stuff compoundcounter += 1 - + # Here comes all the seperator stuff for prompt compounding - if compoundcounter < promptstocompound: - if seperator == "comma": + if(compoundcounter < promptstocompound): + if(seperator == "comma"): completeprompt += " \n , " else: completeprompt += " \n " + seperator + " " - # end of the while loop, now clean up the prompt + + + + + #end of the while loop, now clean up the prompt + + + + # In front and the back? completeprompt = parse_custom_functions(completeprompt, insanitylevel) - + # Sometimes change he/she to the actual subject # Doesnt work if someone puts in a manual subject - if ( - mainchooser == "humanoid" - and givensubject == "" - and subjectchooser != "manwomanmultiple" - ): - samehumanreplacementlist = [ - "-heshe-", - "-heshe-", - "-heshe-", - "-heshe-", - "-heshe-", - "-samehumansubject-", - "-samehumansubject-", - "-samehumansubject-", - "-samehumansubject-", - "-samehumansubject-", - ] + if(mainchooser == "humanoid" and (givensubject == "" or subjectingivensubject and givensubject != "") and subjectchooser != "manwomanmultiple"): + samehumanreplacementlist = ["-heshe-","-heshe-","-heshe-","-heshe-","-heshe-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-", "-samehumansubject-"] random.shuffle(samehumanreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-heshe-") + 1): - if "".join(completeprompt_list[i : i + len("-heshe-")]) == "-heshe-": + if "".join(completeprompt_list[i:i+len("-heshe-")]) == "-heshe-": # Replace -heshe- with a value from the shuffled list replacement = samehumanreplacementlist.pop() - completeprompt_list[i : i + len("-heshe-")] = replacement + completeprompt_list[i:i+len("-heshe-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) - + # Sometimes change he/she to the actual subject - if mainchooser in ["animal", "object"] and givensubject == "": - sameobjectreplacementlist = [ - "-heshe-", - "-heshe-", - "-heshe-", - "-heshe-", - "-heshe-", - "-sameothersubject-", - "-sameothersubject-", - "-sameothersubject-", - "-sameothersubject-", - "-sameothersubject-", - ] + if(mainchooser in ["animal", "object"] and (givensubject == "" or subjectingivensubject and givensubject != "")): + sameobjectreplacementlist = ["-heshe-","-heshe-","-heshe-","-heshe-","-heshe-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-", "-sameothersubject-"] random.shuffle(sameobjectreplacementlist) # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-heshe-") + 1): - if "".join(completeprompt_list[i : i + len("-heshe-")]) == "-heshe-": + if "".join(completeprompt_list[i:i+len("-heshe-")]) == "-heshe-": # Replace -heshe- with a value from the shuffled list replacement = sameobjectreplacementlist.pop() - completeprompt_list[i : i + len("-heshe-")] = replacement + completeprompt_list[i:i+len("-heshe-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) # hair descriptor - if rare_dist(insanitylevel): # Use base hair descriptor, until we are not. + if(rare_dist(insanitylevel)): # Use base hair descriptor, until we are not. completeprompt = completeprompt.replace("-hairdescriptor-", "-descriptor-") - + # human descriptor - if rare_dist(insanitylevel): # Use base human descriptor, until we are not. + if(rare_dist(insanitylevel)): # Use base human descriptor, until we are not. completeprompt = completeprompt.replace("-humandescriptor-", "-descriptor-") - + # location descriptor - if rare_dist(insanitylevel): # Use base location descriptor, until we are not. + if(rare_dist(insanitylevel)): # Use base location descriptor, until we are not. completeprompt = completeprompt.replace("-locationdescriptor-", "-descriptor-") - + # animeal descriptor - if rare_dist(insanitylevel): # Use base animal descriptor, until we are not. + if(rare_dist(insanitylevel)): # Use base animal descriptor, until we are not. completeprompt = completeprompt.replace("-animaldescriptor-", "-descriptor-") + # sometimes, culture becomes traditional! - if unique_dist(insanitylevel): + if(unique_dist(insanitylevel)): completeprompt = completeprompt.replace("-culture-", "traditional -culture-") + # first some manual stuff for outfit - if unique_dist( - insanitylevel - ): # sometimes, its just nice to have descriptor and a normal "outfit". We use mini outfits for this! - completeprompt = completeprompt.replace("-outfit-", "-minioutfit-", 1) - if rare_dist(insanitylevel): # Use base outfit descriptor, until we are not. + if(unique_dist(insanitylevel)): # sometimes, its just nice to have descriptor and a normal "outfit". We use mini outfits for this! + completeprompt = completeprompt.replace("-outfit-", "-minioutfit-",1) + if(rare_dist(insanitylevel)): # Use base outfit descriptor, until we are not. completeprompt = completeprompt.replace("-outfitdescriptor-", "-descriptor-") - if overrideoutfit != "": + if(overrideoutfit != ""): completeprompt = completeprompt.replace("-sameoutfit-", overrideoutfit) - completeprompt = completeprompt.replace("-outfit-", overrideoutfit, 1) - completeprompt = completeprompt.replace("-minioutfit-", overrideoutfit, 1) + completeprompt = completeprompt.replace("-outfit-", overrideoutfit,1) + completeprompt = completeprompt.replace("-minioutfit-", overrideoutfit,1) completeprompt = completeprompt.replace("-overrideoutfit-", overrideoutfit) - if givensubject != "": + if(givensubject != "" and subjectingivensubject == False): completeprompt = completeprompt.replace("-samehumansubject-", givensubject) completeprompt = completeprompt.replace("-sameothersubject-", givensubject) - + + + # If we don't have an override outfit, then remove this part completeprompt = completeprompt.replace("-overrideoutfit-", "") # sometimes replace one descriptor with a artmovement, only on high insanitylevels - if insanitylevel > 7 and unique_dist(insanitylevel): - completeprompt = completeprompt.replace("-descriptor-", "-artmovement-", 1) + if(insanitylevel > 7 and unique_dist(insanitylevel)): + completeprompt = completeprompt.replace("-descriptor-", "-artmovement-",1) # On low insanity levels (lower than 5) ,a chance refer to the basic bitch list on some occasions - if random.randint(0, insanitylevel) == 0 and insanitylevel < 5: - completeprompt = completeprompt.replace( - "-locationdescriptor-", "-basicbitchdescriptor-" - ) - completeprompt = completeprompt.replace( - "-humandescriptor-", "-basicbitchdescriptor-" - ) - completeprompt = completeprompt.replace( - "-outfitdescriptor-", "-basicbitchdescriptor-" - ) - completeprompt = completeprompt.replace( - "-descriptor-", "-basicbitchdescriptor-" - ) - completeprompt = completeprompt.replace( - "-animaldescriptor-", "-basicbitchdescriptor-" - ) + if(random.randint(0,insanitylevel) == 0 and insanitylevel < 5): + completeprompt = completeprompt.replace("-locationdescriptor-", "-basicbitchdescriptor-") + completeprompt = completeprompt.replace("-humandescriptor-", "-basicbitchdescriptor-") + completeprompt = completeprompt.replace("-outfitdescriptor-", "-basicbitchdescriptor-") + completeprompt = completeprompt.replace("-descriptor-", "-basicbitchdescriptor-") + completeprompt = completeprompt.replace("-animaldescriptor-", "-basicbitchdescriptor-") # we now have color combinations, which are stronger than just color. So lets change them while we are at it. - if random.randint(0, max(0, insanitylevel - 2)) <= 0: - completeprompt = completeprompt.replace( - "-color- and -color-", "-colorcombination-" - ) # any color and color becomes a color combination + if(random.randint(0,max(0, insanitylevel - 2)) <= 0): + completeprompt = completeprompt.replace("-color- and -color-", "-colorcombination-") # any color and color becomes a color combination - colorreplacementlist = [ - "-color-", - "-color-", - "-color-", - "-colorcombination-", - "-colorcombination-", - "-colorcombination-", - "-colorcombination-", - "-colorcombination-", - "-colorcombination-", - "-colorcombination-", - ] + colorreplacementlist = ["-color-","-color-","-color-","-colorcombination-","-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-", "-colorcombination-"] random.shuffle(colorreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-color-") + 1): - if "".join(completeprompt_list[i : i + len("-color-")]) == "-color-": + if "".join(completeprompt_list[i:i+len("-color-")]) == "-color-": # Replace -heshe- with a value from the shuffled list replacement = colorreplacementlist.pop() - completeprompt_list[i : i + len("-color-")] = replacement + completeprompt_list[i:i+len("-color-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) - # we now have material combinations, which are stronger than just one material. So lets change them while we are at it. - if random.randint(0, max(0, insanitylevel - 4)) <= 0: - completeprompt = completeprompt.replace( - "-material- and -material-", "-materialcombination-" - ) # any color and color becomes a color combination - materialreplacementlist = [ - "-material-", - "-material-", - "-material-", - "-materialcombination-", - "-materialcombination-", - "-materialcombination-", - "-materialcombination-", - "-materialcombination-", - "-materialcombination-", - "-materialcombination-", - ] + # we now have material combinations, which are stronger than just one material. So lets change them while we are at it. + if(random.randint(0,max(0, insanitylevel - 4)) <= 0): + completeprompt = completeprompt.replace("-material- and -material-", "-materialcombination-") # any color and color becomes a color combination + + materialreplacementlist = ["-material-","-material-","-material-","-materialcombination-","-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-", "-materialcombination-"] random.shuffle(materialreplacementlist) - + # Convert completeprompt to a list to allow character-wise manipulation completeprompt_list = list(completeprompt) # Iterate over the characters in completeprompt_list for i in range(len(completeprompt_list) - len("-material-") + 1): - if "".join(completeprompt_list[i : i + len("-material-")]) == "-material-": + if "".join(completeprompt_list[i:i+len("-material-")]) == "-material-": # Replace -heshe- with a value from the shuffled list replacement = materialreplacementlist.pop() - completeprompt_list[i : i + len("-material-")] = replacement + completeprompt_list[i:i+len("-material-")] = replacement # Convert the list back to a string completeprompt = "".join(completeprompt_list) + + + # 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 - or "-conceptprefix-" in completeprompt - or "-descriptor-" in completeprompt - or "-food-" in completeprompt - or "-haircolor-" in completeprompt - or "-hairstyle-" in completeprompt - or "-job-" in completeprompt - or "-culture-" in completeprompt - or "-accessory-" in completeprompt - or "-humanoid-" in completeprompt - or "-manwoman-" in completeprompt - or "-human-" in completeprompt - or "-colorscheme-" in completeprompt - or "-mood-" in completeprompt - or "-genderdescription-" in completeprompt - or "-artmovement-" in completeprompt - or "-malefemale-" in completeprompt - or "-objecttotal-" in completeprompt - or "-outfitprinttotal-" in completeprompt - or "-bodytype-" in completeprompt - or "-minilocation-" in completeprompt - or "-minilocationaddition-" in completeprompt - or "-pose-" in completeprompt - or "-season-" in completeprompt - or "-minioutfit-" in completeprompt - or "-elaborateoutfit-" in completeprompt - or "-minivomit-" in completeprompt - or "-vomit-" in completeprompt - or "-rpgclass-" in completeprompt - or "-subjectfromfile-" in completeprompt - or "-outfitfromfile-" in completeprompt - or "-brand-" in completeprompt - or "-space-" in completeprompt - or "-artist-" in completeprompt - or "-imagetype-" in completeprompt - or "-othertype-" in completeprompt - or "-quality-" in completeprompt - or "-lighting-" in completeprompt - or "-camera-" in completeprompt - or "-lens-" in completeprompt - or "-imagetypequality-" in completeprompt - or "-poemline-" in completeprompt - or "-songline-" in completeprompt - or "-greatwork-" in completeprompt - or "-fantasyartist-" in completeprompt - or "-popularartist-" in completeprompt - or "-romanticismartist-" in completeprompt - or "-photographyartist-" in completeprompt - or "-emoji-" in completeprompt - or "-timeperiod-" in completeprompt - or "-shotsize-" in completeprompt - or "-musicgenre-" in completeprompt - or "-animaladdition-" in completeprompt - or "-addontolocationinside-" in completeprompt - or "-addontolocation-" in completeprompt - or "-objectaddition-" in completeprompt - or "-humanaddition-" in completeprompt - or "-overalladdition-" in completeprompt - or "-focus-" in completeprompt - or "-direction-" in completeprompt - or "-styletilora-" in completeprompt - or "-manwomanrelation-" in completeprompt - or "-manwomanmultiple-" in completeprompt - or "-waterlocation-" in completeprompt - or "-container-" in completeprompt - or "-firstname-" in completeprompt - or "-flora-" in completeprompt - or "-print-" in completeprompt - or "-miniactivity-" in completeprompt - or "-pattern-" in completeprompt - or "-animalsuffixaddition-" in completeprompt - or "-chair-" in completeprompt - or "-cardname-" in completeprompt - or "-covering-" in completeprompt - or "-heshe-" in completeprompt - or "-hisher-" in completeprompt - or "-himher-" in completeprompt - or "-outfitdescriptor-" in completeprompt - or "-hairdescriptor-" in completeprompt - or "-hairvomit-" in completeprompt - or "-humandescriptor-" in completeprompt - or "-facepart-" in completeprompt - or "-buildfacepart-" in completeprompt - or "-outfitvomit-" in completeprompt - or "-locationdescriptor-" in completeprompt - or "-basicbitchdescriptor-" in completeprompt - or "-animaldescriptor-" in completeprompt - or "-humanexpression-" in completeprompt - or "-humanvomit-" in completeprompt - or "-eyecolor-" in completeprompt - or "-fashiondesigner-" in completeprompt - or "-colorcombination-" in completeprompt - or "-materialcombination-" in completeprompt - or "-oppositefictional-" in completeprompt - or "-oppositenonfictional-" in completeprompt - or "-photoaddition-" in completeprompt - or "-age-" in completeprompt - or "-agecalculator-" in completeprompt - or "-gregmode-" in completeprompt - or "-portraitartist-" in completeprompt - or "-characterartist-" in completeprompt - or "-landscapeartist-" in completeprompt - or "-scifiartist-" in completeprompt - or "-graphicdesignartist-" in completeprompt - or "-digitalartist-" in completeprompt - or "-architectartist-" in completeprompt - or "-cinemaartist-" in completeprompt - or "-element-" in completeprompt - or "-setting-" in completeprompt - or "-charactertype-" in completeprompt - or "-objectstohold-" in completeprompt - or "-episodetitle-" in completeprompt - ): - allwildcardslistnohybrid = [ - "-color-", - "-object-", - "-animal-", - "-fictional-", - "-nonfictional-", - "-building-", - "-vehicle-", - "-location-", - "-conceptprefix-", - "-food-", - "-haircolor-", - "-hairstyle-", - "-job-", - "-accessory-", - "-humanoid-", - "-manwoman-", - "-human-", - "-colorscheme-", - "-mood-", - "-genderdescription-", - "-artmovement-", - "-malefemale-", - "-bodytype-", - "-minilocation-", - "-minilocationaddition-", - "-pose-", - "-season-", - "-minioutfit-", - "-elaborateoutfit-", - "-minivomit-", - "-vomit-", - "-rpgclass-", - "-subjectfromfile-", - "-subjectfromfile-", - "-brand-", - "-space-", - "-artist-", - "-imagetype-", - "-othertype-", - "-quality-", - "-lighting-", - "-camera-", - "-lens-", - "-imagetypequality-", - "-poemline-", - "-songline-", - "-greatwork-", - "-fantasyartist-", - "-popularartist-", - "-romanticismartist-", - "-photographyartist-", - "-emoji-", - "-timeperiod-", - "-shotsize-", - "-musicgenre-", - "-animaladdition-", - "-addontolocationinside-", - "-addontolocation-", - "-objectaddition-", - "-humanaddition-", - "-overalladdition-", - "-focus-", - "-direction-", - "-styletilora-", - "-manwomanrelation-", - "-waterlocation-", - "-container-", - "-firstname-", - "-flora-", - "-print-", - "-miniactivity-", - "-pattern-", - "-animalsuffixaddition-", - "-chair-", - "-cardname-", - "-covering-", - "-heshe-", - "-hisher-", - "-himher-", - "-outfitdescriptor-", - "-hairdescriptor-", - "-hairvomit-", - "-humandescriptor-", - "-manwomanmultiple-", - "-facepart-", - "-buildfacepart-", - "-outfitvomit-", - "-locationdescriptor-", - "-basicbitchdescriptor-", - "-animaldescriptor-", - "-humanexpression-", - "-humanvomit-", - "-eyecolor-", - "-fashiondesigner-", - "-colorcombination-", - "-materialcombination-", - "-oppositefictional-", - "-oppositenonfictional-", - "-photoaddition-", - "-age-", - "-agecalculator-", - "-gregmode-", - "-portraitartist-", - "-characterartist-", - "-landscapeartist-", - "-scifiartist-", - "-graphicdesignartist-", - "-digitalartist-", - "-architectartist-", - "-cinemaartist-", - "-setting-", - "-charactertype-", - "-objectstohold-", - "-episodetitle-", - ] - allwildcardslistnohybridlists = [ - colorlist, - objectlist, - animallist, - fictionallist, - nonfictionallist, - buildinglist, - vehiclelist, - locationlist, - conceptprefixlist, - foodlist, - haircolorlist, - hairstylelist, - joblist, - accessorielist, - humanoidlist, - manwomanlist, - humanlist, - colorschemelist, - moodlist, - genderdescriptionlist, - artmovementlist, - malefemalelist, - bodytypelist, - minilocationlist, - minilocationadditionslist, - poselist, - seasonlist, - minioutfitlist, - elaborateoutfitlist, - minivomitlist, - vomitlist, - rpgclasslist, - customsubjectslist, - customoutfitslist, - brandlist, - spacelist, - artistlist, - imagetypelist, - othertypelist, - qualitylist, - lightinglist, - cameralist, - lenslist, - imagetypequalitylist, - poemlinelist, - songlinelist, - greatworklist, - fantasyartistlist, - popularartistlist, - romanticismartistlist, - photographyartistlist, - emojilist, - timeperiodlist, - shotsizelist, - musicgenrelist, - animaladditionlist, - addontolocationinsidelist, - addontolocationlist, - objectadditionslist, - humanadditionlist, - overalladditionlist, - focuslist, - directionlist, - stylestiloralist, - manwomanrelationlist, - waterlocationlist, - containerlist, - firstnamelist, - floralist, - printlist, - miniactivitylist, - patternlist, - animalsuffixadditionlist, - chairlist, - cardnamelist, - coveringlist, - heshelist, - hisherlist, - himherlist, - outfitdescriptorlist, - hairdescriptorlist, - hairvomitlist, - humandescriptorlist, - manwomanmultiplelist, - facepartlist, - buildfacepartlist, - outfitvomitlist, - locationdescriptorlist, - basicbitchdescriptorlist, - animaldescriptorlist, - humanexpressionlist, - humanvomitlist, - eyecolorlist, - fashiondesignerlist, - colorcombinationlist, - materialcombinationlist, - oppositefictionallist, - oppositenonfictionallist, - photoadditionlist, - agelist, - agecalculatorlist, - gregmodelist, - portraitartistlist, - characterartistlist, - landscapeartistlist, - scifiartistlist, - graphicdesignartistlist, - digitalartistlist, - architectartistlist, - cinemaartistlist, - settinglist, - charactertypelist, - objectstoholdlist, - episodetitlelist, - ] - - allwildcardslistwithhybrid = [ - "-material-", - "-descriptor-", - "-outfit-", - "-conceptsuffix-", - "-culture-", - "-objecttotal-", - "-outfitprinttotal-", - "-element-", - ] - allwildcardslistwithhybridlists = [ - materiallist, - descriptorlist, - outfitlist, - conceptsuffixlist, - culturelist, - objecttotallist, - outfitprinttotallist, - elementlist, - ] - + "-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 or + "-conceptprefix-" in completeprompt or + "-descriptor-" in completeprompt or + "-food-" in completeprompt or + "-haircolor-" in completeprompt or + "-hairstyle-" in completeprompt or + "-job-" in completeprompt or + "-culture-" in completeprompt or + "-accessory-" in completeprompt or + "-humanoid-" in completeprompt or + "-manwoman-" in completeprompt or + "-human-" in completeprompt or + "-colorscheme-" in completeprompt or + "-mood-" in completeprompt or + "-genderdescription-" in completeprompt or + "-artmovement-" in completeprompt or + "-malefemale-" in completeprompt or + "-objecttotal-" in completeprompt or + "-outfitprinttotal-" in completeprompt or + "-bodytype-" in completeprompt or + "-minilocation-" in completeprompt or + "-minilocationaddition-" in completeprompt or + "-pose-" in completeprompt or + "-season-" in completeprompt or + "-minioutfit-" in completeprompt or + "-elaborateoutfit-" in completeprompt or + "-minivomit-" in completeprompt or + "-vomit-" in completeprompt or + "-rpgclass-" in completeprompt or + "-subjectfromfile-" in completeprompt or + "-outfitfromfile-" in completeprompt or + "-brand-" in completeprompt or + "-space-" in completeprompt or + "-artist-" in completeprompt or + "-imagetype-" in completeprompt or + "-othertype-" in completeprompt or + "-quality-" in completeprompt or + "-lighting-" in completeprompt or + "-camera-" in completeprompt or + "-lens-" in completeprompt or + "-imagetypequality-" in completeprompt or + "-poemline-" in completeprompt or + "-songline-" in completeprompt or + "-greatwork-" in completeprompt or + "-fantasyartist-" in completeprompt or + "-popularartist-" in completeprompt or + "-romanticismartist-" in completeprompt or + "-photographyartist-" in completeprompt or + "-emoji-" in completeprompt or + "-timeperiod-" in completeprompt or + "-shotsize-" in completeprompt or + "-musicgenre-" in completeprompt or + "-animaladdition-" in completeprompt or + "-addontolocationinside-" in completeprompt or + "-addontolocation-" in completeprompt or + "-objectaddition-" in completeprompt or + "-humanaddition-" in completeprompt or + "-overalladdition-" in completeprompt or + "-focus-" in completeprompt or + "-direction-" in completeprompt or + "-styletilora-" in completeprompt or + "-manwomanrelation-" in completeprompt or + "-manwomanmultiple-" in completeprompt or + "-waterlocation-" in completeprompt or + "-container-" in completeprompt or + "-firstname-" in completeprompt or + "-flora-" in completeprompt or + "-print-" in completeprompt or + "-miniactivity-" in completeprompt or + "-pattern-" in completeprompt or + "-animalsuffixaddition-" in completeprompt or + "-chair-" in completeprompt or + "-cardname-" in completeprompt or + "-covering-" in completeprompt or + "-heshe-" in completeprompt or + "-hisher-" in completeprompt or + "-himher-" in completeprompt or + "-outfitdescriptor-" in completeprompt or + "-hairdescriptor-" in completeprompt or + "-hairvomit-" in completeprompt or + "-humandescriptor-" in completeprompt or + "-facepart-" in completeprompt or + "-buildfacepart-" in completeprompt or + "-outfitvomit-" in completeprompt or + "-locationdescriptor-" in completeprompt or + "-basicbitchdescriptor-" in completeprompt or + "-animaldescriptor-" in completeprompt or + "-humanexpression-" in completeprompt or + "-humanvomit-" in completeprompt or + "-eyecolor-" in completeprompt or + "-fashiondesigner-" in completeprompt or + "-colorcombination-" in completeprompt or + "-materialcombination-" in completeprompt or + "-oppositefictional-" in completeprompt or + "-oppositenonfictional-" in completeprompt or + "-photoaddition-" in completeprompt or + "-age-" in completeprompt or + "-agecalculator-" in completeprompt or + "-gregmode-" in completeprompt or + "-portraitartist-" in completeprompt or + "-characterartist-" in completeprompt or + "-landscapeartist-" in completeprompt or + "-scifiartist-" in completeprompt or + "-graphicdesignartist-" in completeprompt or + "-digitalartist-" in completeprompt or + "-architectartist-" in completeprompt or + "-cinemaartist-" in completeprompt or + "-element-" in completeprompt or + "-setting-" in completeprompt or + "-charactertype-" in completeprompt or + "-objectstohold-" in completeprompt or + "-episodetitle-" in completeprompt): + allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-","-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-fantasyartist-", "-popularartist-", "-romanticismartist-", "-photographyartist-", "-emoji-", "-timeperiod-", "-shotsize-", "-musicgenre-", "-animaladdition-", "-addontolocationinside-", "-addontolocation-", "-objectaddition-", "-humanaddition-", "-overalladdition-", "-focus-", "-direction-", "-styletilora-", "-manwomanrelation-", "-waterlocation-", "-container-", "-firstname-", "-flora-", "-print-", "-miniactivity-", "-pattern-", "-animalsuffixaddition-", "-chair-", "-cardname-", "-covering-", "-heshe-", "-hisher-", "-himher-", "-outfitdescriptor-", "-hairdescriptor-", "-hairvomit-", "-humandescriptor-", "-manwomanmultiple-", "-facepart-", "-buildfacepart-", "-outfitvomit-", "-locationdescriptor-", "-basicbitchdescriptor-", "-animaldescriptor-", "-humanexpression-", "-humanvomit-", "-eyecolor-", "-fashiondesigner-", "-colorcombination-", "-materialcombination-", "-oppositefictional-", "-oppositenonfictional-", "-photoaddition-", "-age-", "-agecalculator-", "-gregmode-" + ,"-portraitartist-", "-characterartist-" , "-landscapeartist-", "-scifiartist-", "-graphicdesignartist-", "-digitalartist-", "-architectartist-", "-cinemaartist-", "-setting-", "-charactertype-", "-objectstohold-", "-episodetitle-"] + allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, customoutfitslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist, fantasyartistlist, popularartistlist, romanticismartistlist, photographyartistlist, emojilist, timeperiodlist, shotsizelist, musicgenrelist, animaladditionlist, addontolocationinsidelist, addontolocationlist, objectadditionslist, humanadditionlist, overalladditionlist, focuslist, directionlist, stylestiloralist, manwomanrelationlist, waterlocationlist, containerlist, firstnamelist, floralist, printlist, miniactivitylist, patternlist, animalsuffixadditionlist, chairlist, cardnamelist, coveringlist, heshelist, hisherlist, himherlist, outfitdescriptorlist, hairdescriptorlist, hairvomitlist, humandescriptorlist, manwomanmultiplelist, facepartlist, buildfacepartlist, outfitvomitlist, locationdescriptorlist, basicbitchdescriptorlist, animaldescriptorlist, humanexpressionlist, humanvomitlist, eyecolorlist, fashiondesignerlist, colorcombinationlist, materialcombinationlist, oppositefictionallist, oppositenonfictionallist, photoadditionlist, agelist, agecalculatorlist, gregmodelist + , portraitartistlist, characterartistlist, landscapeartistlist, scifiartistlist, graphicdesignartistlist, digitalartistlist, architectartistlist, cinemaartistlist, settinglist, charactertypelist, objectstoholdlist, episodetitlelist] + + allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-", "-outfitprinttotal-", "-element-"] + allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist, outfitprinttotallist, elementlist] + + # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) for wildcard in allwildcardslistnohybrid: - attachedlist = allwildcardslistnohybridlists[ - allwildcardslistnohybrid.index(wildcard) - ] - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - wildcard, - attachedlist, - False, - advancedprompting, - artiststyleselector, - ) + attachedlist = allwildcardslistnohybridlists[allwildcardslistnohybrid.index(wildcard)] + completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,False, advancedprompting, artiststyleselector) + + for wildcard in allwildcardslistwithhybrid: - attachedlist = allwildcardslistwithhybridlists[ - allwildcardslistwithhybrid.index(wildcard) - ] - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - wildcard, - attachedlist, - True, - advancedprompting, - artiststyleselector, - ) + attachedlist = allwildcardslistwithhybridlists[allwildcardslistwithhybrid.index(wildcard)] + completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,True, advancedprompting, artiststyleselector) + + # prompt strenght stuff # if the given subject already is formed like this ( :1.x) # then just ignore this - + matches = [] - if givensubject != "": - pattern = r"\(\w+:\d+\.\d+\)" + if(givensubject != ""): + pattern = r'\(\w+:\d+\.\d+\)' matches = re.findall(pattern, givensubject) - if len(completeprompt) > 325 and matches == []: - if len(completeprompt) < 375: - strenght = "1.1" - elif len(completeprompt) < 450: - strenght = "1.2" - else: - strenght = "1.3" - completeprompt = completeprompt.replace("-objectstrengthstart-", "(") - completeprompt = completeprompt.replace( - "-objectstrengthend-", ":" + strenght + ")" - ) - else: - completeprompt = completeprompt.replace("-objectstrengthstart-", "") - completeprompt = completeprompt.replace("-objectstrengthend-", "") + if(len(completeprompt) > 325 and matches == []): + if(len(completeprompt) < 375): + strenght = "1.1" + elif(len(completeprompt) < 450): + strenght = "1.2" + else: + strenght = "1.3" + completeprompt = completeprompt.replace("-objectstrengthstart-","(") + completeprompt = completeprompt.replace("-objectstrengthend-",":" + strenght + ")") + else: + completeprompt = completeprompt.replace("-objectstrengthstart-","") + completeprompt = completeprompt.replace("-objectstrengthend-","") + + # Now, we are going to parse any custom functions we have build in # this is OR() # OR() - + # OR(foo;bar;bla) --> randomly take foo, bar or bla # OR(foo;bar;bla;uncommon) --> Take foo, unless it hits uncommon roll. Then take bar or bla # OR(;foo) --> empty or foo # OR(;foo;uncommon) --> empty unless it hits uncommon roll. Then take foo # OR(;foo;bar;uncommon) --> empty unless it hits uncommon roll. Then take foo or bar - + + completeprompt = parse_custom_functions(completeprompt, insanitylevel) - + # clean it up completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) - # just for me, some fun with posting fake dev messages (ala old sim games) - if random.randint(1, 50) == 1: + # Split it up for support for prompt_g (subject) and prompt_l (style) + if("@" in completeprompt and prompt_g_and_l == True): + promptlist = completeprompt.split("@") + prompt_g = cleanup(promptlist[1], advancedprompting, insanitylevel) + prompt_l = cleanup((promptlist[0] + ", " + promptlist[2]).replace("of a",""), advancedprompting, insanitylevel) + elif(prompt_g_and_l == True): + prompt_g = completeprompt + prompt_l = completeprompt + + completeprompt = completeprompt.replace(" @ ", " ") + completeprompt = completeprompt.replace("@ ", " ") + completeprompt = completeprompt.replace(" @", " ") + completeprompt = completeprompt.replace("@", " ") + completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) + + #just for me, some fun with posting fake dev messages (ala old sim games) + if(random.randint(1, 50)==1): print("") print(random.choice(devmessagelist)) print("") print(completeprompt) - return completeprompt + if(prompt_g_and_l == False): + return completeprompt + else: + return completeprompt, prompt_g, prompt_l # function that takes an existing prompt and tries to create a variant out of it -def createpromptvariant( - prompt="", - insanitylevel=5, - antivalues="", - gender="all", - artists="all", - advancedprompting=True, -): +def createpromptvariant(prompt = "", insanitylevel = 5, antivalues = "" , gender = "all", artists = "all", advancedprompting = True): # first load the lists, all copied from above (can that be done better?) # do we want to use the same settings or keep it open?? # first build up a complete anti list. Those values are removing during list building # this uses the antivalues string AND the antilist.csv emptylist = [] - antilist = csv_to_list("antilist", emptylist, "./userfiles/", 1) + antilist = csv_to_list("antilist",emptylist , "./userfiles/",1) antivaluelist = antivalues.split(",") antilist += antivaluelist # build all lists here - colorlist = csv_to_list("colors", antilist) - animallist = csv_to_list("animals", antilist) - materiallist = csv_to_list("materials", antilist) - objectlist = csv_to_list("objects", antilist) - fictionallist = csv_to_list( - csvfilename="fictional characters", - antilist=antilist, - skipheader=True, - gender=gender, - ) - nonfictionallist = csv_to_list( - csvfilename="nonfictional characters", - antilist=antilist, - skipheader=True, - gender=gender, - ) - conceptsuffixlist = csv_to_list("concept_suffix", antilist) - buildinglist = csv_to_list("buildings", antilist) - vehiclelist = csv_to_list("vehicles", antilist) - outfitlist = csv_to_list("outfits", antilist) - locationlist = csv_to_list("locations", antilist) + colorlist = csv_to_list("colors",antilist) + animallist = csv_to_list("animals",antilist) + materiallist = csv_to_list("materials",antilist) + objectlist = csv_to_list("objects",antilist) + fictionallist = csv_to_list(csvfilename="fictional characters",antilist=antilist,skipheader=True,gender=gender) + nonfictionallist = csv_to_list(csvfilename="nonfictional characters",antilist=antilist,skipheader=True,gender=gender) + conceptsuffixlist = csv_to_list("concept_suffix",antilist) + buildinglist = csv_to_list("buildings",antilist) + vehiclelist = csv_to_list("vehicles",antilist) + outfitlist = csv_to_list("outfits",antilist) + locationlist = csv_to_list("locations",antilist) - accessorielist = csv_to_list("accessories", antilist, "./csvfiles/", 0, "?") - artmovementlist = csv_to_list("artmovements", antilist) - bodytypelist = csv_to_list("body_types", antilist) - cameralist = csv_to_list("cameras", antilist) - colorschemelist = csv_to_list("colorscheme", antilist) - conceptprefixlist = csv_to_list("concept_prefix", antilist) - culturelist = csv_to_list("cultures", antilist) - descriptorlist = csv_to_list("descriptors", antilist) - devmessagelist = csv_to_list("devmessages", antilist) - directionlist = csv_to_list("directions", antilist) - emojilist = csv_to_list("emojis", antilist) - eventlist = csv_to_list("events", antilist) - focuslist = csv_to_list("focus", antilist) - greatworklist = csv_to_list("greatworks", antilist) - haircolorlist = csv_to_list("haircolors", antilist) - hairstylelist = csv_to_list("hairstyles", antilist) - hairvomitlist = csv_to_list( - "hairvomit", antilist, "./csvfiles/", 0, "?", False, False - ) - humanactivitylist = csv_to_list( - "human_activities", antilist, "./csvfiles/", 0, "?", False, False - ) - humanoidlist = csv_to_list("humanoids", antilist) - imagetypelist = csv_to_list("imagetypes", antilist) - joblist = joblist = csv_to_list( - csvfilename="jobs", antilist=antilist, skipheader=True, gender=gender - ) - lenslist = csv_to_list("lenses", antilist) - lightinglist = csv_to_list("lighting", antilist) - malefemalelist = csv_to_list( - csvfilename="malefemale", antilist=antilist, skipheader=True, gender=gender - ) - manwomanlist = csv_to_list( - csvfilename="manwoman", antilist=antilist, skipheader=True, gender=gender - ) - moodlist = csv_to_list("moods", antilist) - othertypelist = csv_to_list("othertypes", antilist) - poselist = csv_to_list("poses", antilist) - qualitylist = csv_to_list("quality", antilist) - shotsizelist = csv_to_list("shotsizes", antilist) - timeperiodlist = csv_to_list("timeperiods", antilist) - vomitlist = csv_to_list("vomit", antilist) + accessorielist = csv_to_list("accessories",antilist,"./csvfiles/",0,"?") + artmovementlist = csv_to_list("artmovements",antilist) + bodytypelist = csv_to_list("body_types",antilist) + cameralist = csv_to_list("cameras",antilist) + colorschemelist = csv_to_list("colorscheme",antilist) + conceptprefixlist = csv_to_list("concept_prefix",antilist) + culturelist = csv_to_list("cultures",antilist) + descriptorlist = csv_to_list("descriptors",antilist) + devmessagelist = csv_to_list("devmessages",antilist) + directionlist = csv_to_list("directions",antilist) + emojilist = csv_to_list("emojis",antilist) + eventlist = csv_to_list("events",antilist) + focuslist = csv_to_list("focus",antilist) + greatworklist = csv_to_list("greatworks",antilist) + haircolorlist = csv_to_list("haircolors",antilist) + hairstylelist = csv_to_list("hairstyles",antilist) + hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) + humanactivitylist = csv_to_list("human_activities",antilist,"./csvfiles/",0,"?",False,False) + humanoidlist = csv_to_list("humanoids",antilist) + imagetypelist = csv_to_list("imagetypes",antilist) + joblist = joblist = csv_to_list(csvfilename="jobs",antilist=antilist,skipheader=True,gender=gender) + lenslist = csv_to_list("lenses",antilist) + lightinglist = csv_to_list("lighting",antilist) + malefemalelist = csv_to_list(csvfilename="malefemale",antilist=antilist,skipheader=True,gender=gender) + manwomanlist = csv_to_list(csvfilename="manwoman",antilist=antilist,skipheader=True,gender=gender) + moodlist = csv_to_list("moods",antilist) + othertypelist = csv_to_list("othertypes",antilist) + poselist = csv_to_list("poses",antilist) + qualitylist = csv_to_list("quality",antilist) + shotsizelist = csv_to_list("shotsizes",antilist) + timeperiodlist = csv_to_list("timeperiods",antilist) + vomitlist = csv_to_list("vomit",antilist) foodlist = csv_to_list("foods", antilist) - genderdescriptionlist = csv_to_list( - csvfilename="genderdescription", - antilist=antilist, - skipheader=True, - gender=gender, - ) + genderdescriptionlist = csv_to_list(csvfilename="genderdescription",antilist=antilist,skipheader=True,gender=gender) minilocationlist = csv_to_list("minilocations", antilist) - minioutfitlist = csv_to_list( - "minioutfits", antilist, "./csvfiles/", 0, "?", False, False, gender - ) + minioutfitlist = csv_to_list("minioutfits",antilist,"./csvfiles/",0,"?",False,False,gender) seasonlist = csv_to_list("seasons", antilist) elaborateoutfitlist = csv_to_list("elaborateoutfits", antilist) minivomitlist = csv_to_list("minivomit", antilist) @@ -4317,24 +3016,11 @@ def createpromptvariant( poemlinelist = csv_to_list("poemlines", antilist) songlinelist = csv_to_list("songlines", antilist) musicgenrelist = csv_to_list("musicgenres", antilist) - manwomanrelationlist = csv_to_list( - csvfilename="manwomanrelations", - antilist=antilist, - skipheader=True, - gender=gender, - ) - manwomanmultiplelist = csv_to_list( - csvfilename="manwomanmultiples", - antilist=antilist, - skipheader=True, - gender=gender, - delimiter="?", - ) + manwomanrelationlist = csv_to_list(csvfilename="manwomanrelations",antilist=antilist,skipheader=True,gender=gender) + manwomanmultiplelist = csv_to_list(csvfilename="manwomanmultiples",antilist=antilist,skipheader=True,gender=gender,delimiter="?") waterlocationlist = csv_to_list("waterlocations", antilist) containerlist = csv_to_list("containers", antilist) - firstnamelist = csv_to_list( - csvfilename="firstnames", antilist=antilist, skipheader=True, gender=gender - ) + firstnamelist = csv_to_list(csvfilename="firstnames",antilist=antilist,skipheader=True,gender=gender) floralist = csv_to_list("flora", antilist) printlist = csv_to_list("prints", antilist) patternlist = csv_to_list("patterns", antilist) @@ -4342,161 +3028,90 @@ def createpromptvariant( cardnamelist = csv_to_list("card_names", antilist) coveringlist = csv_to_list("coverings", antilist) facepartlist = csv_to_list("faceparts", antilist) - humanexpressionlist = csv_to_list( - csvfilename="humanexpressions", antilist=antilist, delimiter="?" - ) + humanexpressionlist = csv_to_list(csvfilename="humanexpressions",antilist=antilist,delimiter="?") humanvomitlist = csv_to_list("humanvomit", antilist) eyecolorlist = csv_to_list("eyecolors", antilist) fashiondesignerlist = csv_to_list("fashiondesigners", antilist) - colorcombinationlist = csv_to_list("colorcombinations", antilist) - materialcombinationlist = csv_to_list("materialcombinations", antilist) + colorcombinationlist = csv_to_list("colorcombinations", antilist) + materialcombinationlist = csv_to_list("materialcombinations", antilist) agelist = csv_to_list("ages", antilist) agecalculatorlist = csv_to_list("agecalculator", antilist) elementlist = csv_to_list("elements", antilist) settinglist = csv_to_list("settings", antilist) charactertypelist = csv_to_list("charactertypes", antilist) objectstoholdlist = csv_to_list("objectstohold", antilist) - episodetitlelist = csv_to_list( - csvfilename="episodetitles", antilist=antilist, skipheader=True - ) + episodetitlelist = csv_to_list(csvfilename="episodetitles",antilist=antilist,skipheader=True) - outfitdescriptorlist = csv_to_list("outfitdescriptors", antilist) - hairdescriptorlist = csv_to_list("hairdescriptors", antilist) - humandescriptorlist = csv_to_list("humandescriptors", antilist) - locationdescriptorlist = csv_to_list("locationdescriptors", antilist) - basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors", antilist) - animaldescriptorlist = csv_to_list("animaldescriptors", antilist) + outfitdescriptorlist = csv_to_list("outfitdescriptors",antilist) + hairdescriptorlist = csv_to_list("hairdescriptors",antilist) + humandescriptorlist = csv_to_list("humandescriptors",antilist) + locationdescriptorlist = csv_to_list("locationdescriptors",antilist) + basicbitchdescriptorlist = csv_to_list("basicbitchdescriptors",antilist) + animaldescriptorlist = csv_to_list("animaldescriptors",antilist) - humanlist = ( - fictionallist - + nonfictionallist - + humanoidlist - + malefemalelist - + manwomanlist - + manwomanrelationlist - + manwomanmultiplelist - ) - objecttotallist = ( - objectlist - + buildinglist - + vehiclelist - + foodlist - + spacelist - + floralist - + containerlist - ) - outfitprinttotallist = ( - objecttotallist - + locationlist - + colorlist - + musicgenrelist - + seasonlist - + animallist - + patternlist - ) + humanlist = fictionallist + nonfictionallist + humanoidlist + malefemalelist + manwomanlist + manwomanrelationlist + manwomanmultiplelist + objecttotallist = objectlist + buildinglist + vehiclelist + foodlist + spacelist + floralist + containerlist + outfitprinttotallist = objecttotallist + locationlist + colorlist + musicgenrelist + seasonlist + animallist + patternlist # build artists list + if artists == "wild": + artists = "all (wild)" artistlist = [] # create artist list to use in the code, maybe based on category or personal lists - if ( - artists != "all" - and artists != "none" - and artists.startswith("personal_artists") == False - and artists.startswith("personal artists") == False - ): - artistlist = artist_category_csv_to_list("artists_and_category", artists) - elif ( - artists.startswith("personal_artists") == True - or artists.startswith("personal artists") == True - ): - artists = artists.replace(" ", "_", -1) # add underscores back in - artistlist = csv_to_list(artists, antilist, "./userfiles/") - elif artists != "none": - artistlist = csv_to_list("artists", antilist) + if(artists != "all" and artists != "none" and artists.startswith("personal_artists") == False and artists.startswith("personal artists") == False): + artistlist = artist_category_csv_to_list("artists_and_category",artists) + elif(artists.startswith("personal_artists") == True or artists.startswith("personal artists") == True): + artists = artists.replace(" ","_",-1) # add underscores back in + artistlist = csv_to_list(artists,antilist,"./userfiles/") + elif(artists != "none"): + artistlist = csv_to_list("artists",antilist) # create special artists lists, used in templates - fantasyartistlist = artist_category_csv_to_list("artists_and_category", "fantasy") - popularartistlist = artist_category_csv_to_list("artists_and_category", "popular") - romanticismartistlist = artist_category_csv_to_list( - "artists_and_category", "romanticism" - ) - photographyartistlist = artist_category_csv_to_list( - "artists_and_category", "photography" - ) - portraitartistlist = artist_category_csv_to_list("artists_and_category", "portrait") - characterartistlist = artist_category_csv_to_list( - "artists_and_category", "character" - ) - landscapeartistlist = artist_category_csv_to_list( - "artists_and_category", "landscape" - ) - scifiartistlist = artist_category_csv_to_list("artists_and_category", "sci-fi") - graphicdesignartistlist = artist_category_csv_to_list( - "artists_and_category", "graphic design" - ) - digitalartistlist = artist_category_csv_to_list("artists_and_category", "digital") - architectartistlist = artist_category_csv_to_list( - "artists_and_category", "architecture" - ) - cinemaartistlist = artist_category_csv_to_list("artists_and_category", "cinema") + fantasyartistlist = artist_category_csv_to_list("artists_and_category","fantasy") + popularartistlist = artist_category_csv_to_list("artists_and_category","popular") + romanticismartistlist = artist_category_csv_to_list("artists_and_category","romanticism") + photographyartistlist = artist_category_csv_to_list("artists_and_category","photography") + portraitartistlist = artist_category_csv_to_list("artists_and_category","portrait") + characterartistlist = artist_category_csv_to_list("artists_and_category","character") + landscapeartistlist = artist_category_csv_to_list("artists_and_category","landscape") + scifiartistlist = artist_category_csv_to_list("artists_and_category","sci-fi") + graphicdesignartistlist = artist_category_csv_to_list("artists_and_category","graphic design") + digitalartistlist = artist_category_csv_to_list("artists_and_category","digital") + architectartistlist = artist_category_csv_to_list("artists_and_category","architecture") + cinemaartistlist = artist_category_csv_to_list("artists_and_category","cinema") gregmodelist = csv_to_list("gregmode", antilist) # add any other custom lists - stylestiloralist = csv_to_list("styles_ti_lora", antilist, "./userfiles/") - generatestyle = bool(stylestiloralist) # True of not empty + stylestiloralist = csv_to_list("styles_ti_lora",antilist,"./userfiles/") + generatestyle = bool(stylestiloralist) # True of not empty - custominputprefixlist = csv_to_list("custom_input_prefix", antilist, "./userfiles/") - generatecustominputprefix = bool(custominputprefixlist) # True of not empty + custominputprefixlist = csv_to_list("custom_input_prefix",antilist,"./userfiles/") + generatecustominputprefix = bool(custominputprefixlist) # True of not empty - custominputmidlist = csv_to_list("custom_input_mid", antilist, "./userfiles/") - generatecustominputmid = bool(custominputmidlist) # True of not empty + custominputmidlist = csv_to_list("custom_input_mid",antilist,"./userfiles/") + generatecustominputmid = bool(custominputmidlist) # True of not empty - custominputsuffixlist = csv_to_list("custom_input_suffix", antilist, "./userfiles/") - generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty + custominputsuffixlist = csv_to_list("custom_input_suffix",antilist,"./userfiles/") + generatecustominputsuffix = bool(custominputsuffixlist) # True of not empty - customsubjectslist = csv_to_list("custom_subjects", antilist, "./userfiles/") - customoutfitslist = csv_to_list("custom_outfits", antilist, "./userfiles/") + customsubjectslist = csv_to_list("custom_subjects",antilist,"./userfiles/") + customoutfitslist = csv_to_list("custom_outfits",antilist,"./userfiles/") # special lists - backgroundtypelist = csv_to_list( - "backgroundtypes", antilist, "./csvfiles/special_lists/", 0, "?" - ) - insideshotlist = csv_to_list( - "insideshots", antilist, "./csvfiles/special_lists/", 0, "?" - ) - photoadditionlist = csv_to_list( - "photoadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildhairlist = csv_to_list( - "buildhair", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildoutfitlist = csv_to_list( - "buildoutfit", antilist, "./csvfiles/special_lists/", 0, "?" - ) - objectadditionslist = csv_to_list( - "objectadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - humanadditionlist = csv_to_list( - "humanadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - animaladditionlist = csv_to_list( - "animaladditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - buildaccessorielist = csv_to_list( - "buildaccessorie", antilist, "./csvfiles/special_lists/", 0, "?" - ) - minilocationadditionslist = csv_to_list( - "minilocationadditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - overalladditionlist = csv_to_list( - "overalladditions", antilist, "./csvfiles/special_lists/", 0, "?" - ) - imagetypemodelist = csv_to_list( - "imagetypemodes", antilist, "./csvfiles/special_lists/", 0, "?" - ) - miniactivitylist = csv_to_list( - "miniactivity", antilist, "./csvfiles/special_lists/", 0, "?" - ) + backgroundtypelist = csv_to_list("backgroundtypes", antilist,"./csvfiles/special_lists/",0,"?") + insideshotlist = csv_to_list("insideshots", antilist,"./csvfiles/special_lists/",0,"?") + photoadditionlist = csv_to_list("photoadditions", antilist,"./csvfiles/special_lists/",0,"?") + buildhairlist = csv_to_list("buildhair", antilist,"./csvfiles/special_lists/",0,"?") + buildoutfitlist = csv_to_list("buildoutfit", antilist,"./csvfiles/special_lists/",0,"?") + objectadditionslist = csv_to_list("objectadditions", antilist,"./csvfiles/special_lists/",0,"?") + humanadditionlist = csv_to_list("humanadditions", antilist,"./csvfiles/special_lists/",0,"?") + animaladditionlist = csv_to_list("animaladditions", antilist,"./csvfiles/special_lists/",0,"?") + buildaccessorielist = csv_to_list("buildaccessorie", antilist,"./csvfiles/special_lists/",0,"?") + minilocationadditionslist = csv_to_list("minilocationadditions", antilist,"./csvfiles/special_lists/",0,"?") + overalladditionlist = csv_to_list("overalladditions", antilist,"./csvfiles/special_lists/",0,"?") + imagetypemodelist = csv_to_list("imagetypemodes", antilist,"./csvfiles/special_lists/",0,"?") + miniactivitylist = csv_to_list("miniactivity", antilist,"./csvfiles/special_lists/",0,"?") + prompt = prompt.replace(",", " , ") prompt = prompt.replace("(", " ( ") @@ -4511,961 +3126,525 @@ def createpromptvariant( originalprompt = prompt ### Get all combinations of 1 to 4 consecutive words + words = prompt.split() num_words = len(words) - + combinations_list = [] - + for length in range(1, 5): # Generate combinations of length 1 to 4 for start_idx in range(num_words - length + 1): end_idx = start_idx + length - combination = " ".join(words[start_idx:end_idx]) + combination = ' '.join(words[start_idx:end_idx]) combinations_list.append(combination) - + maxamountofruns = 4 runs = 0 - if insanitylevel != 0: + if(insanitylevel != 0): print("") print("Creating a prompt variation") print("") - while originalprompt == prompt and runs != maxamountofruns: + while(originalprompt == prompt and runs != maxamountofruns): for combination in combinations_list: lowercase_combination = combination.lower() combination = " " + combination + " " - # some rare changes if needed - if lowercase_combination in [ - x.lower() for x in humanlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -human- ") + # some rare changes if needed + if lowercase_combination in [x.lower() for x in humanlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -human- ") - if lowercase_combination in [ - x.lower() for x in objecttotallist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -objecttotal- ") + if lowercase_combination in [x.lower() for x in objecttotallist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -objecttotal- ") + + if lowercase_combination in [x.lower() for x in artistlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -artist- ") + - if lowercase_combination in [ - x.lower() for x in artistlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -artist- ") + if lowercase_combination in [x.lower() for x in colorlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -color- ") - if lowercase_combination in [ - x.lower() for x in colorlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -color- ") + if lowercase_combination in [x.lower() for x in animallist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -animal- ") + + if lowercase_combination in [x.lower() for x in objectlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -object- ") + + if lowercase_combination in [x.lower() for x in fictionallist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -fictional- ") - if lowercase_combination in [ - x.lower() for x in animallist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -animal- ") + + if lowercase_combination in [x.lower() for x in nonfictionallist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -nonfictional- ") - if lowercase_combination in [ - x.lower() for x in objectlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -object- ") - - if lowercase_combination in [ - x.lower() for x in fictionallist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -fictional- ") - - if lowercase_combination in [ - x.lower() for x in nonfictionallist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -nonfictional- ") - - # if lowercase_combination in [x.lower() for x in conceptsuffixlist] and chance_roll(insanitylevel, "uncommon"): + + #if lowercase_combination in [x.lower() for x in conceptsuffixlist] and chance_roll(insanitylevel, "uncommon"): # prompt = prompt.replace(combination," -conceptsuffix- ") - if lowercase_combination in [ - x.lower() for x in buildinglist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -building- ") + + if lowercase_combination in [x.lower() for x in buildinglist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -building- ") - if lowercase_combination in [ - x.lower() for x in vehiclelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -vehicle- ") + + if lowercase_combination in [x.lower() for x in vehiclelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -vehicle- ") - if lowercase_combination in [ - x.lower() for x in outfitlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -outfit- ") + + if lowercase_combination in [x.lower() for x in outfitlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -outfit- ") - if lowercase_combination in [ - x.lower() for x in locationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -location- ") + + if lowercase_combination in [x.lower() for x in locationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -location- ") - if lowercase_combination in [ - x.lower() for x in accessorielist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -accessory- ") + + if lowercase_combination in [x.lower() for x in accessorielist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -accessory- ") - if lowercase_combination in [ - x.lower() for x in artmovementlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -artmovement- ") + + if lowercase_combination in [x.lower() for x in artmovementlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -artmovement- ") - if lowercase_combination in [ - x.lower() for x in bodytypelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -bodytype- ") + + if lowercase_combination in [x.lower() for x in bodytypelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -bodytype- ") - if lowercase_combination in [ - x.lower() for x in cameralist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -camera- ") + + if lowercase_combination in [x.lower() for x in cameralist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -camera- ") - if lowercase_combination in [ - x.lower() for x in colorschemelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -colorscheme- ") + + if lowercase_combination in [x.lower() for x in colorschemelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -colorscheme- ") - if lowercase_combination in [ - x.lower() for x in eyecolorlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -eyecolor- ") + if lowercase_combination in [x.lower() for x in eyecolorlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -eyecolor- ") - if lowercase_combination in [ - x.lower() for x in fashiondesignerlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -fashiondesigner- ") + if lowercase_combination in [x.lower() for x in fashiondesignerlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -fashiondesigner- ") - if lowercase_combination in [ - x.lower() for x in colorcombinationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -colorcombination- ") + if lowercase_combination in [x.lower() for x in colorcombinationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -colorcombination- ") - if lowercase_combination in [ - x.lower() for x in materialcombinationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -materialcombination- ") + if lowercase_combination in [x.lower() for x in materialcombinationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -materialcombination- ") - if lowercase_combination in [ - x.lower() for x in photoadditionlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -photoaddition- ") + if lowercase_combination in [x.lower() for x in photoadditionlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -photoaddition- ") - if lowercase_combination in [ - x.lower() for x in agelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -age- ") + if lowercase_combination in [x.lower() for x in agelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -age- ") - if lowercase_combination in [ - x.lower() for x in agecalculatorlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -agecalculator- ") + if lowercase_combination in [x.lower() for x in agecalculatorlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -agecalculator- ") - if lowercase_combination in [ - x.lower() for x in gregmodelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -gregmode- ") + if lowercase_combination in [x.lower() for x in gregmodelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -gregmode- ") - if lowercase_combination in [ - x.lower() for x in elementlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -element- ") + if lowercase_combination in [x.lower() for x in elementlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -element- ") - if lowercase_combination in [ - x.lower() for x in settinglist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -setting- ") + if lowercase_combination in [x.lower() for x in settinglist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -setting- ") + + if lowercase_combination in [x.lower() for x in charactertypelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -charactertype- ") + if lowercase_combination in [x.lower() for x in objectstoholdlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -objectstohold- ") + if lowercase_combination in [x.lower() for x in episodetitlelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -episodetitle- ") - if lowercase_combination in [ - x.lower() for x in charactertypelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -charactertype- ") - if lowercase_combination in [ - x.lower() for x in objectstoholdlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -objectstohold- ") - if lowercase_combination in [ - x.lower() for x in episodetitlelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -episodetitle- ") - - # if lowercase_combination in [x.lower() for x in conceptprefixlist] and chance_roll(insanitylevel, "uncommon"): + + #if lowercase_combination in [x.lower() for x in conceptprefixlist] and chance_roll(insanitylevel, "uncommon"): # prompt = prompt.replace(combination," -conceptprefix- ") - if lowercase_combination in [ - x.lower() for x in culturelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -culture- ") + + if lowercase_combination in [x.lower() for x in culturelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -culture- ") - if lowercase_combination in [ - x.lower() for x in descriptorlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -descriptor- ") + + if lowercase_combination in [x.lower() for x in descriptorlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -descriptor- ") - if lowercase_combination in [ - x.lower() for x in outfitdescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -outfitdescriptor- ") - if lowercase_combination in [ - x.lower() for x in hairdescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -hairdescriptor- ") - if lowercase_combination in [ - x.lower() for x in hairvomitlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -hairvomit- ") - if lowercase_combination in [ - x.lower() for x in humandescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -humandescriptor- ") - if lowercase_combination in [ - x.lower() for x in locationdescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -locationdescriptor- ") - if lowercase_combination in [ - x.lower() for x in basicbitchdescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -basicbitchdescriptor- ") - if lowercase_combination in [ - x.lower() for x in animaldescriptorlist - ] and chance_roll(insanitylevel, "rare"): - prompt = prompt.replace(combination, " -animaldescriptor- ") + if lowercase_combination in [x.lower() for x in outfitdescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -outfitdescriptor- ") + if lowercase_combination in [x.lower() for x in hairdescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -hairdescriptor- ") + if lowercase_combination in [x.lower() for x in hairvomitlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -hairvomit- ") + if lowercase_combination in [x.lower() for x in humandescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -humandescriptor- ") + if lowercase_combination in [x.lower() for x in locationdescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -locationdescriptor- ") + if lowercase_combination in [x.lower() for x in basicbitchdescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -basicbitchdescriptor- ") + if lowercase_combination in [x.lower() for x in animaldescriptorlist] and chance_roll(insanitylevel, "rare"): + prompt = prompt.replace(combination," -animaldescriptor- ") - if lowercase_combination in [ - x.lower() for x in directionlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -direction- ") + if lowercase_combination in [x.lower() for x in directionlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -direction- ") - if lowercase_combination in [ - x.lower() for x in emojilist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -emoji- ") + if lowercase_combination in [x.lower() for x in emojilist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -emoji- ") - if lowercase_combination in [ - x.lower() for x in humanexpressionlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -humanexpression- ") - if lowercase_combination in [ - x.lower() for x in humanvomitlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -humanvomit- ") + if lowercase_combination in [x.lower() for x in humanexpressionlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -humanexpression- ") + if lowercase_combination in [x.lower() for x in humanvomitlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -humanvomit- ") + + if lowercase_combination in [x.lower() for x in eventlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -event- ") - if lowercase_combination in [ - x.lower() for x in eventlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -event- ") + if lowercase_combination in [x.lower() for x in focuslist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -focus- ") - if lowercase_combination in [ - x.lower() for x in focuslist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -focus- ") + if lowercase_combination in [x.lower() for x in greatworklist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -greatwork- ") - if lowercase_combination in [ - x.lower() for x in greatworklist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -greatwork- ") + if lowercase_combination in [x.lower() for x in haircolorlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -haircolor- ") - if lowercase_combination in [ - x.lower() for x in haircolorlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -haircolor- ") + if lowercase_combination in [x.lower() for x in hairstylelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -hairstyle- ") - if lowercase_combination in [ - x.lower() for x in hairstylelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -hairstyle- ") + if lowercase_combination in [x.lower() for x in directionlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -direction- ") - if lowercase_combination in [ - x.lower() for x in directionlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -direction- ") + if lowercase_combination in [x.lower() for x in humanoidlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -humanoid- ") - if lowercase_combination in [ - x.lower() for x in humanoidlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -humanoid- ") + if lowercase_combination in [x.lower() for x in joblist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -job- ") - if lowercase_combination in [ - x.lower() for x in joblist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -job- ") + if lowercase_combination in [x.lower() for x in lenslist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -lens- ") + if lowercase_combination in [x.lower() for x in lightinglist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -lighting- ") + if lowercase_combination in [x.lower() for x in malefemalelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -malefemale- ") + if lowercase_combination in [x.lower() for x in manwomanlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -manwoman- ") + if lowercase_combination in [x.lower() for x in moodlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -mood- ") + if lowercase_combination in [x.lower() for x in othertypelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -othertype- ") + if lowercase_combination in [x.lower() for x in poselist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -pose- ") + if lowercase_combination in [x.lower() for x in qualitylist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -quality- ") + if lowercase_combination in [x.lower() for x in shotsizelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -shotsize- ") + if lowercase_combination in [x.lower() for x in timeperiodlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -timeperiod- ") + if lowercase_combination in [x.lower() for x in vomitlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -vomit- ") + if lowercase_combination in [x.lower() for x in foodlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -food- ") + if lowercase_combination in [x.lower() for x in genderdescriptionlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -genderdescription- ") + if lowercase_combination in [x.lower() for x in minilocationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -minilocation- ") + if lowercase_combination in [x.lower() for x in minioutfitlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -minioutfit- ") + if lowercase_combination in [x.lower() for x in lenslist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -lens- ") + if lowercase_combination in [x.lower() for x in seasonlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -season- ") + if lowercase_combination in [x.lower() for x in imagetypequalitylist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -imagetypequality- ") + if lowercase_combination in [x.lower() for x in rpgclasslist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -rpgclass- ") + if lowercase_combination in [x.lower() for x in brandlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -brand- ") + if lowercase_combination in [x.lower() for x in spacelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -space- ") + if lowercase_combination in [x.lower() for x in poemlinelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -poemline- ") + if lowercase_combination in [x.lower() for x in songlinelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -songline- ") + if lowercase_combination in [x.lower() for x in musicgenrelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -musicgenre- ") + if lowercase_combination in [x.lower() for x in manwomanrelationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -manwomanrelation- ") + if lowercase_combination in [x.lower() for x in manwomanmultiplelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -manwomanmultiple- ") + if lowercase_combination in [x.lower() for x in waterlocationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -waterlocation- ") + if lowercase_combination in [x.lower() for x in containerlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -container- ") + if lowercase_combination in [x.lower() for x in firstnamelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -firstname- ") + if lowercase_combination in [x.lower() for x in floralist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -flora- ") + if lowercase_combination in [x.lower() for x in printlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -print- ") + if lowercase_combination in [x.lower() for x in miniactivitylist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -miniactivity- ") + if lowercase_combination in [x.lower() for x in patternlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -pattern- ") + if lowercase_combination in [x.lower() for x in chairlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -chair- ") + if lowercase_combination in [x.lower() for x in cardnamelist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -cardname- ") + if lowercase_combination in [x.lower() for x in coveringlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -covering- ") + if lowercase_combination in [x.lower() for x in facepartlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -facepart- ") - if lowercase_combination in [ - x.lower() for x in lenslist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -lens- ") - if lowercase_combination in [ - x.lower() for x in lightinglist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -lighting- ") - if lowercase_combination in [ - x.lower() for x in malefemalelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -malefemale- ") - if lowercase_combination in [ - x.lower() for x in manwomanlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -manwoman- ") - if lowercase_combination in [ - x.lower() for x in moodlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -mood- ") - if lowercase_combination in [ - x.lower() for x in othertypelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -othertype- ") - if lowercase_combination in [ - x.lower() for x in poselist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -pose- ") - if lowercase_combination in [ - x.lower() for x in qualitylist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -quality- ") - if lowercase_combination in [ - x.lower() for x in shotsizelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -shotsize- ") - if lowercase_combination in [ - x.lower() for x in timeperiodlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -timeperiod- ") - if lowercase_combination in [ - x.lower() for x in vomitlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -vomit- ") - if lowercase_combination in [ - x.lower() for x in foodlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -food- ") - if lowercase_combination in [ - x.lower() for x in genderdescriptionlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -genderdescription- ") - if lowercase_combination in [ - x.lower() for x in minilocationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -minilocation- ") - if lowercase_combination in [ - x.lower() for x in minioutfitlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -minioutfit- ") - if lowercase_combination in [ - x.lower() for x in lenslist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -lens- ") - if lowercase_combination in [ - x.lower() for x in seasonlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -season- ") - if lowercase_combination in [ - x.lower() for x in imagetypequalitylist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -imagetypequality- ") - if lowercase_combination in [ - x.lower() for x in rpgclasslist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -rpgclass- ") - if lowercase_combination in [ - x.lower() for x in brandlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -brand- ") - if lowercase_combination in [ - x.lower() for x in spacelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -space- ") - if lowercase_combination in [ - x.lower() for x in poemlinelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -poemline- ") - if lowercase_combination in [ - x.lower() for x in songlinelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -songline- ") - if lowercase_combination in [ - x.lower() for x in musicgenrelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -musicgenre- ") - if lowercase_combination in [ - x.lower() for x in manwomanrelationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -manwomanrelation- ") - if lowercase_combination in [ - x.lower() for x in manwomanmultiplelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -manwomanmultiple- ") - if lowercase_combination in [ - x.lower() for x in waterlocationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -waterlocation- ") - if lowercase_combination in [ - x.lower() for x in containerlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -container- ") - if lowercase_combination in [ - x.lower() for x in firstnamelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -firstname- ") - if lowercase_combination in [ - x.lower() for x in floralist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -flora- ") - if lowercase_combination in [ - x.lower() for x in printlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -print- ") - if lowercase_combination in [ - x.lower() for x in miniactivitylist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -miniactivity- ") - if lowercase_combination in [ - x.lower() for x in patternlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -pattern- ") - if lowercase_combination in [ - x.lower() for x in chairlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -chair- ") - if lowercase_combination in [ - x.lower() for x in cardnamelist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -cardname- ") - if lowercase_combination in [ - x.lower() for x in coveringlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -covering- ") - if lowercase_combination in [ - x.lower() for x in facepartlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -facepart- ") - if lowercase_combination in [ - x.lower() for x in fantasyartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -fantasyartist- ") - if lowercase_combination in [ - x.lower() for x in popularartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -popularartist- ") - if lowercase_combination in [ - x.lower() for x in romanticismartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -romanticismartist- ") - if lowercase_combination in [ - x.lower() for x in photographyartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -photographyartist- ") - if lowercase_combination in [ - x.lower() for x in portraitartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -portraitartist- ") - if lowercase_combination in [ - x.lower() for x in characterartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -characterartist- ") - if lowercase_combination in [ - x.lower() for x in landscapeartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -landscapeartist- ") - if lowercase_combination in [ - x.lower() for x in scifiartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -scifiartist- ") - if lowercase_combination in [ - x.lower() for x in graphicdesignartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -graphicdesignartist- ") - if lowercase_combination in [ - x.lower() for x in architectartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -architectartist- ") - if lowercase_combination in [ - x.lower() for x in cinemaartistlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -cinemaartist- ") + if lowercase_combination in [x.lower() for x in fantasyartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -fantasyartist- ") + if lowercase_combination in [x.lower() for x in popularartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -popularartist- ") + if lowercase_combination in [x.lower() for x in romanticismartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -romanticismartist- ") + if lowercase_combination in [x.lower() for x in photographyartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -photographyartist- ") + if lowercase_combination in [x.lower() for x in portraitartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -portraitartist- ") + if lowercase_combination in [x.lower() for x in characterartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -characterartist- ") + if lowercase_combination in [x.lower() for x in landscapeartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -landscapeartist- ") + if lowercase_combination in [x.lower() for x in scifiartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -scifiartist- ") + if lowercase_combination in [x.lower() for x in graphicdesignartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -graphicdesignartist- ") + if lowercase_combination in [x.lower() for x in architectartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -architectartist- ") + if lowercase_combination in [x.lower() for x in cinemaartistlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -cinemaartist- ") - if lowercase_combination in [ - x.lower() for x in stylestiloralist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -styletilora- ") - if lowercase_combination in [ - x.lower() for x in waterlocationlist - ] and chance_roll(insanitylevel, "uncommon"): - prompt = prompt.replace(combination, " -waterlocation- ") + + if lowercase_combination in [x.lower() for x in stylestiloralist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -styletilora- ") + if lowercase_combination in [x.lower() for x in waterlocationlist] and chance_roll(insanitylevel, "uncommon"): + prompt = prompt.replace(combination," -waterlocation- ") runs += 1 + + prompt = prompt.replace(" :", ":") prompt = prompt.replace(": ", ":") completeprompt = prompt + 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 - or "-conceptprefix-" in completeprompt - or "-descriptor-" in completeprompt - or "-food-" in completeprompt - or "-haircolor-" in completeprompt - or "-hairstyle-" in completeprompt - or "-job-" in completeprompt - or "-culture-" in completeprompt - or "-accessory-" in completeprompt - or "-humanoid-" in completeprompt - or "-manwoman-" in completeprompt - or "-human-" in completeprompt - or "-colorscheme-" in completeprompt - or "-mood-" in completeprompt - or "-genderdescription-" in completeprompt - or "-artmovement-" in completeprompt - or "-malefemale-" in completeprompt - or "-objecttotal-" in completeprompt - or "-outfitprinttotal-" in completeprompt - or "-bodytype-" in completeprompt - or "-minilocation-" in completeprompt - or "-minilocationaddition-" in completeprompt - or "-pose-" in completeprompt - or "-season-" in completeprompt - or "-minioutfit-" in completeprompt - or "-elaborateoutfit-" in completeprompt - or "-minivomit-" in completeprompt - or "-vomit-" in completeprompt - or "-rpgclass-" in completeprompt - or "-subjectfromfile-" in completeprompt - or "-outfitfromfile-" in completeprompt - or "-brand-" in completeprompt - or "-space-" in completeprompt - or "-artist-" in completeprompt - or "-imagetype-" in completeprompt - or "-othertype-" in completeprompt - or "-quality-" in completeprompt - or "-lighting-" in completeprompt - or "-camera-" in completeprompt - or "-lens-" in completeprompt - or "-imagetypequality-" in completeprompt - or "-poemline-" in completeprompt - or "-songline-" in completeprompt - or "-greatwork-" in completeprompt - or "-fantasyartist-" in completeprompt - or "-popularartist-" in completeprompt - or "-romanticismartist-" in completeprompt - or "-photographyartist-" in completeprompt - or "-emoji-" in completeprompt - or "-timeperiod-" in completeprompt - or "-shotsize-" in completeprompt - or "-musicgenre-" in completeprompt - or "-animaladdition-" in completeprompt - or "-objectaddition-" in completeprompt - or "-humanaddition-" in completeprompt - or "-overalladdition-" in completeprompt - or "-focus-" in completeprompt - or "-direction-" in completeprompt - or "-styletilora-" in completeprompt - or "-manwomanrelation-" in completeprompt - or "-manwomanmultiple-" in completeprompt - or "-waterlocation-" in completeprompt - or "-container-" in completeprompt - or "-firstname-" in completeprompt - or "-flora-" in completeprompt - or "-print-" in completeprompt - or "-miniactivity-" in completeprompt - or "-pattern-" in completeprompt - or "-chair-" in completeprompt - or "-cardname-" in completeprompt - or "-covering-" in completeprompt - or "-outfitdescriptor-" in completeprompt - or "-hairdescriptor-" in completeprompt - or "-hairvomit-" in completeprompt - or "-humandescriptor-" in completeprompt - or "-facepart-" in completeprompt - or "-locationdescriptor-" in completeprompt - or "-basicbitchdescriptor-" in completeprompt - or "-animaldescriptor-" in completeprompt - or "-humanexpression-" in completeprompt - or "-humanvomit-" in completeprompt - or "-eyecolor-" in completeprompt - or "-fashiondesigner-" in completeprompt - or "-colorcombination-" in completeprompt - or "-materialcombination-" in completeprompt - or "-photoaddition-" in completeprompt - or "-age-" in completeprompt - or "-agecalculator-" in completeprompt - or "-gregmode-" in completeprompt - or "-portraitartist-" in completeprompt - or "-characterartist-" in completeprompt - or "-landscapeartist-" in completeprompt - or "-scifiartist-" in completeprompt - or "-graphicdesignartist-" in completeprompt - or "-digitalartist-" in completeprompt - or "-architectartist-" in completeprompt - or "-cinemaartist-" in completeprompt - or "-element-" in completeprompt - or "-setting-" in completeprompt - or "-charactertype-" in completeprompt - or "-objectstohold-" in completeprompt - or "-episodetitle-" in completeprompt - ): - allwildcardslistnohybrid = [ - "-color-", - "-object-", - "-animal-", - "-fictional-", - "-nonfictional-", - "-building-", - "-vehicle-", - "-location-", - "-conceptprefix-", - "-food-", - "-haircolor-", - "-hairstyle-", - "-job-", - "-accessory-", - "-humanoid-", - "-manwoman-", - "-human-", - "-colorscheme-", - "-mood-", - "-genderdescription-", - "-artmovement-", - "-malefemale-", - "-bodytype-", - "-minilocation-", - "-minilocationaddition-", - "-pose-", - "-season-", - "-minioutfit-", - "-elaborateoutfit-", - "-minivomit-", - "-vomit-", - "-rpgclass-", - "-subjectfromfile-", - "-subjectfromfile-", - "-brand-", - "-space-", - "-artist-", - "-imagetype-", - "-othertype-", - "-quality-", - "-lighting-", - "-camera-", - "-lens-", - "-imagetypequality-", - "-poemline-", - "-songline-", - "-greatwork-", - "-fantasyartist-", - "-popularartist-", - "-romanticismartist-", - "-photographyartist-", - "-emoji-", - "-timeperiod-", - "-shotsize-", - "-musicgenre-", - "-animaladdition-", - "-objectaddition-", - "-humanaddition-", - "-overalladdition-", - "-focus-", - "-direction-", - "-styletilora-", - "-manwomanrelation-", - "-waterlocation-", - "-container-", - "-firstname-", - "-flora-", - "-print-", - "-miniactivity-", - "-pattern-", - "-chair-", - "-cardname-", - "-covering-", - "-outfitdescriptor-", - "-hairdescriptor-", - "-hairvomit-", - "-humandescriptor-", - "-manwomanmultiple-", - "-facepart-", - "-locationdescriptor-", - "-basicbitchdescriptor-", - "-animaldescriptor-", - "-humanexpression-", - "-humanvomit-", - "-eyecolor-", - "-fashiondesigner-", - "-colorcombination-", - "-materialcombination-", - "-photoaddition-", - "-age-", - "agecalculator-", - "-gregmode-", - "-portraitartist-", - "-characterartist-", - "-landscapeartist-", - "-scifiartist-", - "-graphicdesignartist-", - "-digitalartist-", - "-architectartist-", - "-cinemaartist-", - "-setting-", - "-charactertype-", - "-objectstohold-", - "-episodetitle-", - ] - allwildcardslistnohybridlists = [ - colorlist, - objectlist, - animallist, - fictionallist, - nonfictionallist, - buildinglist, - vehiclelist, - locationlist, - conceptprefixlist, - foodlist, - haircolorlist, - hairstylelist, - joblist, - accessorielist, - humanoidlist, - manwomanlist, - humanlist, - colorschemelist, - moodlist, - genderdescriptionlist, - artmovementlist, - malefemalelist, - bodytypelist, - minilocationlist, - minilocationadditionslist, - poselist, - seasonlist, - minioutfitlist, - elaborateoutfitlist, - minivomitlist, - vomitlist, - rpgclasslist, - customsubjectslist, - customoutfitslist, - brandlist, - spacelist, - artistlist, - imagetypelist, - othertypelist, - qualitylist, - lightinglist, - cameralist, - lenslist, - imagetypequalitylist, - poemlinelist, - songlinelist, - greatworklist, - fantasyartistlist, - popularartistlist, - romanticismartistlist, - photographyartistlist, - emojilist, - timeperiodlist, - shotsizelist, - musicgenrelist, - animaladditionlist, - objectadditionslist, - humanadditionlist, - overalladditionlist, - focuslist, - directionlist, - stylestiloralist, - manwomanrelationlist, - waterlocationlist, - containerlist, - firstnamelist, - floralist, - printlist, - miniactivitylist, - patternlist, - chairlist, - cardnamelist, - coveringlist, - outfitdescriptorlist, - hairdescriptorlist, - hairvomitlist, - humandescriptorlist, - manwomanmultiplelist, - facepartlist, - locationdescriptorlist, - basicbitchdescriptorlist, - animaldescriptorlist, - humanexpressionlist, - humanvomitlist, - eyecolorlist, - fashiondesignerlist, - colorcombinationlist, - materialcombinationlist, - photoadditionlist, - agelist, - agecalculatorlist, - gregmodelist, - portraitartistlist, - characterartistlist, - landscapeartistlist, - scifiartistlist, - graphicdesignartistlist, - digitalartistlist, - architectartistlist, - cinemaartistlist, - settinglist, - charactertypelist, - objectstoholdlist, - episodetitlelist, - ] + "-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 or + "-conceptprefix-" in completeprompt or + "-descriptor-" in completeprompt or + "-food-" in completeprompt or + "-haircolor-" in completeprompt or + "-hairstyle-" in completeprompt or + "-job-" in completeprompt or + "-culture-" in completeprompt or + "-accessory-" in completeprompt or + "-humanoid-" in completeprompt or + "-manwoman-" in completeprompt or + "-human-" in completeprompt or + "-colorscheme-" in completeprompt or + "-mood-" in completeprompt or + "-genderdescription-" in completeprompt or + "-artmovement-" in completeprompt or + "-malefemale-" in completeprompt or + "-objecttotal-" in completeprompt or + "-outfitprinttotal-" in completeprompt or + "-bodytype-" in completeprompt or + "-minilocation-" in completeprompt or + "-minilocationaddition-" in completeprompt or + "-pose-" in completeprompt or + "-season-" in completeprompt or + "-minioutfit-" in completeprompt or + "-elaborateoutfit-" in completeprompt or + "-minivomit-" in completeprompt or + "-vomit-" in completeprompt or + "-rpgclass-" in completeprompt or + "-subjectfromfile-" in completeprompt or + "-outfitfromfile-" in completeprompt or + "-brand-" in completeprompt or + "-space-" in completeprompt or + "-artist-" in completeprompt or + "-imagetype-" in completeprompt or + "-othertype-" in completeprompt or + "-quality-" in completeprompt or + "-lighting-" in completeprompt or + "-camera-" in completeprompt or + "-lens-" in completeprompt or + "-imagetypequality-" in completeprompt or + "-poemline-" in completeprompt or + "-songline-" in completeprompt or + "-greatwork-" in completeprompt or + "-fantasyartist-" in completeprompt or + "-popularartist-" in completeprompt or + "-romanticismartist-" in completeprompt or + "-photographyartist-" in completeprompt or + "-emoji-" in completeprompt or + "-timeperiod-" in completeprompt or + "-shotsize-" in completeprompt or + "-musicgenre-" in completeprompt or + "-animaladdition-" in completeprompt or + "-objectaddition-" in completeprompt or + "-humanaddition-" in completeprompt or + "-overalladdition-" in completeprompt or + "-focus-" in completeprompt or + "-direction-" in completeprompt or + "-styletilora-" in completeprompt or + "-manwomanrelation-" in completeprompt or + "-manwomanmultiple-" in completeprompt or + "-waterlocation-" in completeprompt or + "-container-" in completeprompt or + "-firstname-" in completeprompt or + "-flora-" in completeprompt or + "-print-" in completeprompt or + "-miniactivity-" in completeprompt or + "-pattern-" in completeprompt or + "-chair-" in completeprompt or + "-cardname-" in completeprompt or + "-covering-" in completeprompt or + "-outfitdescriptor-" in completeprompt or + "-hairdescriptor-" in completeprompt or + "-hairvomit-" in completeprompt or + "-humandescriptor-" in completeprompt or + "-facepart-" in completeprompt or + "-locationdescriptor-" in completeprompt or + "-basicbitchdescriptor-" in completeprompt or + "-animaldescriptor-" in completeprompt or + "-humanexpression-" in completeprompt or + "-humanvomit-" in completeprompt or + "-eyecolor-" in completeprompt or + "-fashiondesigner-" in completeprompt or + "-colorcombination-" in completeprompt or + "-materialcombination-" in completeprompt or + "-photoaddition-" in completeprompt or + "-age-" in completeprompt or + "-agecalculator-" in completeprompt or + "-gregmode-" in completeprompt or + "-portraitartist-" in completeprompt or + "-characterartist-" in completeprompt or + "-landscapeartist-" in completeprompt or + "-scifiartist-" in completeprompt or + "-graphicdesignartist-" in completeprompt or + "-digitalartist-" in completeprompt or + "-architectartist-" in completeprompt or + "-cinemaartist-" in completeprompt or + "-element-" in completeprompt or + "-setting-" in completeprompt or + "-charactertype-" in completeprompt or + "-objectstohold-" in completeprompt or + "-episodetitle-" in completeprompt + ): + allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-", "-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-fantasyartist-", "-popularartist-", "-romanticismartist-", "-photographyartist-", "-emoji-", "-timeperiod-", "-shotsize-", "-musicgenre-", "-animaladdition-", "-objectaddition-", "-humanaddition-", "-overalladdition-", "-focus-", "-direction-", "-styletilora-", "-manwomanrelation-", "-waterlocation-", "-container-", "-firstname-", "-flora-", "-print-", "-miniactivity-", "-pattern-", "-chair-", "-cardname-", "-covering-", "-outfitdescriptor-", "-hairdescriptor-", "-hairvomit-", "-humandescriptor-", "-manwomanmultiple-", "-facepart-", "-locationdescriptor-", "-basicbitchdescriptor-", "-animaldescriptor-", "-humanexpression-", "-humanvomit-", "-eyecolor-", "-fashiondesigner-", "-colorcombination-", "-materialcombination-", "-photoaddition-", "-age-", "agecalculator-", "-gregmode-" + ,"-portraitartist-", "-characterartist-" , "-landscapeartist-", "-scifiartist-", "-graphicdesignartist-", "-digitalartist-", "-architectartist-", "-cinemaartist-", "-setting-", "-charactertype-", "-objectstohold-", "-episodetitle-"] + allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, customoutfitslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist, fantasyartistlist, popularartistlist, romanticismartistlist, photographyartistlist, emojilist, timeperiodlist, shotsizelist, musicgenrelist, animaladditionlist, objectadditionslist, humanadditionlist, overalladditionlist, focuslist, directionlist, stylestiloralist, manwomanrelationlist, waterlocationlist, containerlist, firstnamelist, floralist, printlist, miniactivitylist, patternlist, chairlist, cardnamelist, coveringlist, outfitdescriptorlist, hairdescriptorlist, hairvomitlist, humandescriptorlist, manwomanmultiplelist, facepartlist, locationdescriptorlist, basicbitchdescriptorlist, animaldescriptorlist, humanexpressionlist, humanvomitlist, eyecolorlist, fashiondesignerlist, colorcombinationlist, materialcombinationlist, photoadditionlist, agelist, agecalculatorlist, gregmodelist + , portraitartistlist, characterartistlist, landscapeartistlist, scifiartistlist, graphicdesignartistlist, digitalartistlist, architectartistlist, cinemaartistlist, settinglist, charactertypelist, objectstoholdlist, episodetitlelist] + + allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-", "-outfitprinttotal-", "-element-"] + allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist, outfitprinttotallist, elementlist] + + + # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) + for wildcard in allwildcardslistnohybrid: + attachedlist = allwildcardslistnohybridlists[allwildcardslistnohybrid.index(wildcard)] + completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,False, advancedprompting) - allwildcardslistwithhybrid = [ - "-material-", - "-descriptor-", - "-outfit-", - "-conceptsuffix-", - "-culture-", - "-objecttotal-", - "-outfitprinttotal-", - "-element-", - ] - allwildcardslistwithhybridlists = [ - materiallist, - descriptorlist, - outfitlist, - conceptsuffixlist, - culturelist, - objecttotallist, - outfitprinttotallist, - elementlist, - ] - # keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) - for wildcard in allwildcardslistnohybrid: - attachedlist = allwildcardslistnohybridlists[ - allwildcardslistnohybrid.index(wildcard) - ] - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - wildcard, - attachedlist, - False, - advancedprompting, - ) + + for wildcard in allwildcardslistwithhybrid: + attachedlist = allwildcardslistwithhybridlists[allwildcardslistwithhybrid.index(wildcard)] + completeprompt = replacewildcard(completeprompt, insanitylevel, wildcard, attachedlist,True, advancedprompting) - for wildcard in allwildcardslistwithhybrid: - attachedlist = allwildcardslistwithhybridlists[ - allwildcardslistwithhybrid.index(wildcard) - ] - completeprompt = replacewildcard( - completeprompt, - insanitylevel, - wildcard, - attachedlist, - True, - advancedprompting, - ) + # clean it up completeprompt = cleanup(completeprompt, advancedprompting, insanitylevel) + + + + return completeprompt # function +def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehybridorswap, advancedprompting, artiststyleselector = ""): - -def replacewildcard( - completeprompt, - insanitylevel, - wildcard, - listname, - activatehybridorswap, - advancedprompting, - artiststyleselector="", -): - if len(listname) == 0: + if(len(listname) == 0): # handling empty lists - completeprompt = completeprompt.replace(wildcard, "", 1) + completeprompt = completeprompt.replace(wildcard, "",1) else: + while wildcard in completeprompt: - if ( - unique_dist(insanitylevel) - and activatehybridorswap == True - and len(listname) > 2 - and advancedprompting == True - ): + if(unique_dist(insanitylevel) and activatehybridorswap == True and len(listname)>2 and advancedprompting==True): hybridorswaplist = ["hybrid", "swap"] hybridorswap = random.choice(hybridorswaplist) replacementvalue = random.choice(listname) listname.remove(replacementvalue) hybridorswapreplacementvalue = "[" + replacementvalue + + if(hybridorswap == "hybrid"): + replacementvalue = random.choice(listname) + listname.remove(replacementvalue) + hybridorswapreplacementvalue += "|" + replacementvalue + "] " + if(hybridorswap == "swap"): + replacementvalue = random.choice(listname) + listname.remove(replacementvalue) + hybridorswapreplacementvalue += ":" + replacementvalue + ":" + str(random.randint(1,20)) + "] " + + completeprompt = completeprompt.replace(wildcard, hybridorswapreplacementvalue,1) - if hybridorswap == "hybrid": - replacementvalue = random.choice(listname) - listname.remove(replacementvalue) - hybridorswapreplacementvalue += "|" + replacementvalue + "] " - if hybridorswap == "swap": - replacementvalue = random.choice(listname) - listname.remove(replacementvalue) - hybridorswapreplacementvalue += ( - ":" + replacementvalue + ":" + str(random.randint(1, 20)) + "] " - ) - - completeprompt = completeprompt.replace( - wildcard, hybridorswapreplacementvalue, 1 - ) - - # if list is not empty - if bool(listname): + #if list is not empty + if(bool(listname)): replacementvalue = random.choice(listname) - if wildcard not in ["-heshe-", "-himher-", "-hisher-"]: + if(wildcard not in ["-heshe-", "-himher-","-hisher-"]): listname.remove(replacementvalue) + + else: replacementvalue = "" # override for artist and artiststyle, only for first artist - if wildcard == "-artist-" and "-artiststyle-" in completeprompt: + if(wildcard == "-artist-" and "-artiststyle-" in completeprompt): artiststyles = [] artiststyle = [] chosenartiststyle = "" - artiststyles = artist_category_by_category_csv_to_list( - "artists_and_category", replacementvalue - ) + artiststyles = artist_category_by_category_csv_to_list("artists_and_category",replacementvalue) artiststyle = [x.strip() for x in artiststyles[0].split(",")] - artiststyle = list( - filter(lambda x: len(x) > 0, artiststyle) - ) # remove empty values + artiststyle = list(filter(lambda x: len(x) > 0, artiststyle)) # remove empty values - if artiststyleselector in artiststyle: + if(artiststyleselector in artiststyle): artiststyle.remove(artiststyleselector) # Sorry folks, this only works when you directly select it as a style - if "nudity" in artiststyle: + if("nudity" in artiststyle): artiststyle.remove("nudity") # keep on looping until we have no more wildcards or no more styles to choose from # leftovers will be removed in the cleaning step while bool(artiststyle) and "-artiststyle-" in completeprompt: + chosenartiststyle = random.choice(artiststyle) - completeprompt = completeprompt.replace( - "-artiststyle-", chosenartiststyle, 1 - ) + completeprompt = completeprompt.replace("-artiststyle-",chosenartiststyle ,1) artiststyle.remove(chosenartiststyle) + + # Sneaky overrides for "same" wildcards # Are overwritten with their first parent - if wildcard == "-outfit-" or wildcard == "-minioutfit-": - completeprompt = completeprompt.replace( - "-sameoutfit-", replacementvalue, 1 - ) + if(wildcard == "-outfit-" or wildcard == "-minioutfit-"): + completeprompt = completeprompt.replace("-sameoutfit-", replacementvalue,1) # Why do it in this detail?? Because we can: # Check if "from" exists in the string. For example Chun Li from Streetfighter, becomes Chun li @@ -5478,96 +3657,87 @@ def replacewildcard( else: replacementvalueforoverrides = replacementvalue - if ( - wildcard - in [ - "-human-", - "-humanoid-", - "-manwoman-", - "-manwomanrelation-", - "-manwomanmultiple-", - ] - and "-samehumansubject-" in completeprompt - ): - if completeprompt.index(wildcard) < completeprompt.index( - "-samehumansubject-" - ): - completeprompt = completeprompt.replace( - "-samehumansubject-", "the " + replacementvalueforoverrides - ) - - if ( - wildcard - in [ - "-fictional-", - "-nonfictional-", - "-firstname-", - "-oppositefictional-", - "-oppositenonfictional-", - ] - and "-samehumansubject-" in completeprompt - ): - if completeprompt.index(wildcard) < completeprompt.index( - "-samehumansubject-" - ): - completeprompt = completeprompt.replace( - "-samehumansubject-", replacementvalueforoverrides - ) - + if(wildcard in ["-human-" + ,"-humanoid-" + , "-manwoman-" + , "-manwomanrelation-" + , "-manwomanmultiple-"] + and "-samehumansubject-" in completeprompt): + if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): + completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) + + if(wildcard in ["-fictional-" + , "-nonfictional-" + , "-firstname-" + , "-oppositefictional-" + , "-oppositenonfictional-"] + and "-samehumansubject-" in completeprompt): + if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): + completeprompt = completeprompt.replace("-samehumansubject-", replacementvalueforoverrides) + # job is here, to prevent issue with a job outfit being replace. So doing it later solves that issue - if wildcard in ["-job-"] and "-samehumansubject-" in completeprompt: - if completeprompt.index(wildcard) < completeprompt.index( - "-samehumansubject-" - ): - completeprompt = completeprompt.replace( - "-samehumansubject-", "the " + replacementvalueforoverrides - ) - + if(wildcard in ["-job-"] + and "-samehumansubject-" in completeprompt): + if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): + completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) + + # This one last, since then it is the only subject we have left - if wildcard in ["-malefemale-"] and "-samehumansubject-" in completeprompt: - if completeprompt.index(wildcard) < completeprompt.index( - "-samehumansubject-" - ): - completeprompt = completeprompt.replace( - "-samehumansubject-", "the " + replacementvalueforoverrides - ) + if(wildcard in ["-malefemale-"] + and "-samehumansubject-" in completeprompt): + if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")): + completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalueforoverrides) - if ( - wildcard - in [ - "-animal-", - "-object-", - "-vehicle-", - "-food-", - "-objecttotal-", - "-space-", - "-flora-", - "-location-", - "-building-", - ] - and "-sameothersubject-" in completeprompt - ): - if completeprompt.index(wildcard) < completeprompt.index( - "-sameothersubject-" - ): - completeprompt = completeprompt.replace( - "-sameothersubject-", "the " + replacementvalueforoverrides - ) + if(wildcard in ["-animal-" + , "-object-" + , "-vehicle-" + , "-food-" + , "-objecttotal-" + , "-space-" + , "-flora-" + , "-location-" + , "-building-"] + and "-sameothersubject-" in completeprompt): + if(completeprompt.index(wildcard) < completeprompt.index("-sameothersubject-")): + completeprompt = completeprompt.replace("-sameothersubject-", "the " + replacementvalueforoverrides) + + + + completeprompt = completeprompt.replace(wildcard, replacementvalue,1) + + - completeprompt = completeprompt.replace(wildcard, replacementvalue, 1) return completeprompt +def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): + negativewordsfulllist = csv_to_list(csvfilename="negativewords", directory="./csvfiles/special_lists/", delimiter=";") + print(negativewordsfulllist) + + negative_primer = [] + negative_result = [] + + for i, item in enumerate(negativewordsfulllist): + values = [val.strip() for val in item.split(',')] + + if i == 0: + negative_primer = values + elif i == 1: + negative_result = values + + print(negative_primer) + print(negative_result) + return negative_result def replace_match(match): # Extract the first word from the match - words = match.group(0)[1:-1].split("|") + words = match.group(0)[1:-1].split('|') return words[0] +def cleanup(completeprompt, advancedprompting, insanitylevel = 5): -def cleanup(completeprompt, advancedprompting, insanitylevel=5): # This part is turned off, will bring it back later as an option - + # first, move LoRA's to the back dynamically # Find all occurrences of text between < and > using regex @@ -5576,9 +3746,10 @@ def cleanup(completeprompt, advancedprompting, insanitylevel=5): # Remove the extracted matches from completeprompt # completeprompt = re.sub(r"<[^>]+>", "", completeprompt) + # if we are not using advanced prompting, remove any hybrid stuff: - if advancedprompting == False: - hybridpattern = r"\[\w+\|\w+\]" + if(advancedprompting==False): + hybridpattern = r'\[\w+\|\w+\]' # Replace the matched pattern with the first word in the group completeprompt = re.sub(hybridpattern, replace_match, completeprompt) @@ -5588,125 +3759,118 @@ def cleanup(completeprompt, advancedprompting, insanitylevel=5): completeprompt = completeprompt.replace("|", " ") # sometimes if there are not enough artist, we get left we things formed as (:1.2) - completeprompt = re.sub("\(\:\d+\.\d+\)", "", completeprompt) + completeprompt = re.sub('\(\:\d+\.\d+\)', '', completeprompt) # lets also remove some wierd stuff on lower insanitylevels - if insanitylevel < 7: + if(insanitylevel < 7): completeprompt = completeprompt.replace("DayGlo", " ") completeprompt = completeprompt.replace("fluorescent", " ") # all cleanup steps moved here - completeprompt = re.sub("\[ ", "[", completeprompt) - completeprompt = re.sub("\[,", "[", completeprompt) - completeprompt = re.sub(" \]", "]", completeprompt) - completeprompt = re.sub(" \|", "|", completeprompt) - completeprompt = re.sub(' "', '"', completeprompt) - completeprompt = re.sub('" ', '"', completeprompt) - completeprompt = re.sub("\( ", "(", completeprompt) - completeprompt = re.sub(" \(", "(", completeprompt) - completeprompt = re.sub("\) ", ")", completeprompt) - completeprompt = re.sub(" \)", ")", completeprompt) + completeprompt = re.sub('\[ ', '[', completeprompt) + completeprompt = re.sub('\[,', '[', completeprompt) + completeprompt = re.sub(' \]', ']', completeprompt) + completeprompt = re.sub(' \|', '|', completeprompt) + #completeprompt = re.sub(' \"', '\"', completeprompt) + #completeprompt = re.sub('\" ', '\"', completeprompt) + completeprompt = re.sub('\( ', '(', completeprompt) + completeprompt = re.sub(' \(', '(', completeprompt) + completeprompt = re.sub('\) ', ')', completeprompt) + completeprompt = re.sub(' \)', ')', completeprompt) - completeprompt = re.sub(" :", ":", completeprompt) - completeprompt = re.sub(",::", "::", completeprompt) - completeprompt = re.sub(",:", ":", completeprompt) + completeprompt = re.sub(' :', ':', completeprompt) + completeprompt = re.sub(',::', '::', completeprompt) + completeprompt = re.sub(',:', ':', completeprompt) - completeprompt = re.sub(",,", ", ", completeprompt) - completeprompt = re.sub(",,", ", ", completeprompt) - completeprompt = re.sub(",,,", ", ", completeprompt) - completeprompt = re.sub(", ,", ",", completeprompt) - completeprompt = re.sub(" , ", ", ", completeprompt) - completeprompt = re.sub(" ,", ",", completeprompt) - completeprompt = re.sub(",\(", ", (", completeprompt) + completeprompt = re.sub(',,', ', ', completeprompt) + completeprompt = re.sub(',,', ', ', completeprompt) + completeprompt = re.sub(',,,', ', ', completeprompt) + completeprompt = re.sub(', ,', ',', completeprompt) + completeprompt = re.sub(' , ', ', ', completeprompt) + completeprompt = re.sub(' ,', ',', completeprompt) + completeprompt = re.sub(',\(', ', (', completeprompt) while " " in completeprompt: - completeprompt = re.sub(" ", " ", completeprompt) - completeprompt = re.sub("a The", "The", completeprompt) - completeprompt = re.sub("the the", "the", completeprompt) - completeprompt = re.sub(", ,", ",", completeprompt) - completeprompt = re.sub(",,", ",", completeprompt) + completeprompt = re.sub(' ', ' ', completeprompt) + completeprompt = re.sub('a The', 'The', completeprompt) + completeprompt = re.sub('the the', 'the', completeprompt) + completeprompt = re.sub(', ,', ',', completeprompt) + completeprompt = re.sub(',,', ',', completeprompt) - completeprompt = re.sub(", of a", " of a", completeprompt) - completeprompt = re.sub("of a,", "of a", completeprompt) - completeprompt = re.sub("of a of a", "of a", completeprompt) - completeprompt = re.sub(" a a ", " a ", completeprompt) + completeprompt = re.sub(', of a', ' of a', completeprompt) + completeprompt = re.sub('of a,', 'of a', completeprompt) + completeprompt = re.sub('of a of a', 'of a', completeprompt) + completeprompt = re.sub(' a a ', ' a ', completeprompt) # a / an - completeprompt = re.sub(" a a", " an a", completeprompt) - completeprompt = re.sub(" a e", " an e", completeprompt) - completeprompt = re.sub(" a i", " an i", completeprompt) - completeprompt = re.sub(" a u", " an u", completeprompt) - completeprompt = re.sub(" a o", " an o", completeprompt) + completeprompt = re.sub(' a a', ' an a', completeprompt) + completeprompt = re.sub(' a e', ' an e', completeprompt) + completeprompt = re.sub(' a i', ' an i', completeprompt) + completeprompt = re.sub(' a u', ' an u', completeprompt) + completeprompt = re.sub(' a o', ' an o', completeprompt) - completeprompt = re.sub("art art", "art", completeprompt) - completeprompt = re.sub("-artiststyle- art,", "", completeprompt) - completeprompt = re.sub("-artiststyle- art", "", completeprompt) - completeprompt = re.sub("-artiststyle-", "", completeprompt) - completeprompt = re.sub("- art ", "", completeprompt) - completeprompt = re.sub("a his", "his", completeprompt) - completeprompt = re.sub("a her", "her", completeprompt) - completeprompt = re.sub("they is", "they are", completeprompt) - completeprompt = re.sub("they has", "they have", completeprompt) + completeprompt = re.sub('art art', 'art', completeprompt) + completeprompt = re.sub('-artiststyle- art,', '', completeprompt) + completeprompt = re.sub('-artiststyle- art', '', completeprompt) + completeprompt = re.sub('-artiststyle-', '', completeprompt) + completeprompt = re.sub('- art ', '', completeprompt) + + + completeprompt = re.sub('a his', 'his', completeprompt) + completeprompt = re.sub('a her', 'her', completeprompt) + completeprompt = re.sub('they is', 'they are', completeprompt) + completeprompt = re.sub('they has', 'they have', completeprompt) # some space tricks - completeprompt = re.sub("- shaped", "-shaped", completeprompt) - completeprompt = re.sub("echa- ", "echa-", completeprompt) - completeprompt = re.sub("style -", "style-", completeprompt) + completeprompt = re.sub('- shaped', '-shaped', completeprompt) + completeprompt = re.sub('echa- ', 'echa-', completeprompt) + completeprompt = re.sub('style -', 'style-', completeprompt) + + #small fix for multisubject thing + completeprompt = re.sub('a 2', '2', completeprompt) + completeprompt = re.sub('a 3', '3', completeprompt) + completeprompt = re.sub('a 4', '4', completeprompt) + completeprompt = re.sub('a 5', '5', completeprompt) - # small fix for multisubject thing - completeprompt = re.sub("a 2", "2", completeprompt) - completeprompt = re.sub("a 3", "3", completeprompt) - completeprompt = re.sub("a 4", "4", completeprompt) - completeprompt = re.sub("a 5", "5", completeprompt) # clean up some hacky multiples with adding a s to the end - completeprompt = re.sub("fs ", "ves ", completeprompt) - completeprompt = re.sub("fs,", "ves,", completeprompt) - completeprompt = re.sub("sss ", "ss ", completeprompt) - completeprompt = re.sub("sss,", "ss,", completeprompt) - completeprompt = re.sub(" Mans", " Men,", completeprompt) - completeprompt = re.sub(" mans", " men", completeprompt) - completeprompt = re.sub(" Womans,", " Women", completeprompt) - completeprompt = re.sub(" womans,", " women,", completeprompt) - completeprompt = re.sub("\(Mans", "(Men,", completeprompt) - completeprompt = re.sub("\(mans", "(men", completeprompt) - completeprompt = re.sub("\(Womans", "(Women", completeprompt) - completeprompt = re.sub("\(womans", "(women", completeprompt) + completeprompt = re.sub('fs ', 'ves ', completeprompt) + completeprompt = re.sub('fs,', 'ves,', completeprompt) + completeprompt = re.sub('sss ', 'ss ', completeprompt) + completeprompt = re.sub('sss,', 'ss,', completeprompt) + completeprompt = re.sub(' Mans', ' Men,', completeprompt) + completeprompt = re.sub(' mans', ' men', completeprompt) + completeprompt = re.sub(' Womans,', ' Women', completeprompt) + completeprompt = re.sub(' womans,', ' women,', completeprompt) + completeprompt = re.sub('\(Mans', '(Men,', completeprompt) + completeprompt = re.sub('\(mans', '(men', completeprompt) + completeprompt = re.sub('\(Womans', '(Women', completeprompt) + completeprompt = re.sub('\(womans', '(women', completeprompt) - completeprompt = re.sub("-sameothersubject-", "it", completeprompt) - completeprompt = re.sub("-samehumansubject-", "the person", completeprompt) + completeprompt = re.sub('-sameothersubject-', 'it', completeprompt) + completeprompt = re.sub('-samehumansubject-', 'the person', completeprompt) - completeprompt = re.sub("(? Date: Sat, 30 Dec 2023 10:43:26 +0100 Subject: [PATCH 03/10] first version of negative prompter --- build_dynamic_prompt.py | 122 ++++--- csv_reader.py | 18 + csvfiles/card_names.csv | 409 ++++++++++++++++++++++- csvfiles/special_lists/negativewords.csv | 112 ++++++- negativeprompttester.py | 5 +- 5 files changed, 622 insertions(+), 44 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 88961fc..5c80676 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -846,32 +846,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # Remove any list/logic with keywords, such as: # wearing, bodytype, pose, location, hair, background - # first get all the words - - # Split the string by commas and spaces - words = re.split(r'[,\s]+', givensubject) - # Remove leading/trailing whitespaces from each word - words = [word.strip() for word in words] - - # Filter out empty words - words = [word for word in words if word] - - # Convert the list to a set to remove duplicates, then convert it back to a list - givensubjectlistsinglewords = list(set(words)) - - # now get all words clumped together by commas - if ',' in givensubject: - allwords = givensubject.split(',') - else: - allwords = [givensubject] - # Remove leading/trailing whitespaces from each word and convert to lowercase - words = [word.strip().lower() for word in allwords] - - # Filter out empty words and duplicates - givensubjectlistwords = list(set(filter(None, words))) - - givensubjectlist = givensubjectlistsinglewords + givensubjectlistwords - + # use function to split up the words + givensubjectlist = split_prompt_to_words(givensubject) # Check only for the lists that make sense? @@ -884,14 +860,14 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # bodytype foundinlist = any(word.lower() in [item.lower() for item in bodytypelist] for word in givensubjectlist) - keywordslist = ["bodytype","body type"] + keywordslist = ["bodytype","body type","model"] keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) if(foundinlist == True or keywordsinstring == True): generatebodytype = False # hair foundinlist = any(word.lower() in [item.lower() for item in hairstylelist] for word in givensubjectlist) - keywordslist = ["hair"] + keywordslist = ["hair","hairstyle"] keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) if(foundinlist == True or keywordsinstring == True): generatehairstyle = False @@ -905,7 +881,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # background foundinlist = any(word.lower() in [item.lower() for item in locationlist] for word in givensubjectlist) foundinlist2 = any(word.lower() in [item.lower() for item in buildinglist] for word in givensubjectlist) - keywordslist = ["location","background", "inside"] + keywordslist = ["location","background", "inside", "at the", "in a"] keywordsinstring = any(word.lower() in givensubject.lower() for word in keywordslist) if(foundinlist == True or foundinlist2 == True or keywordsinstring == True): generatebackground = False @@ -3711,22 +3687,57 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy return completeprompt def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): - negativewordsfulllist = csv_to_list(csvfilename="negativewords", directory="./csvfiles/special_lists/", delimiter=";") - print(negativewordsfulllist) + negative_primer = [] negative_result = [] + all_negative_words_list = [] + + # negavite_primer, all words that should trigger a negative result + # the negative words to put in the negative prompt + negative_primer, negative_result = load_negative_list() - for i, item in enumerate(negativewordsfulllist): - values = [val.strip() for val in item.split(',')] - - if i == 0: - negative_primer = values - elif i == 1: - negative_result = values + allwords = split_prompt_to_words(postive_prompt) + + for word in allwords: + if(word in negative_primer): + index_of_word = negative_primer.index(word) + all_negative_words_list.append(negative_result[index_of_word]) + + all_negative_words = ", ".join(all_negative_words_list) + all_negative_words_list = all_negative_words.split(",") + all_negative_words_list = [elem.strip().lower() for elem in all_negative_words_list] + + + # new lets remove some based on the reverse insanitylevel + removalchance = int((insanitylevel) * 10) + + for i in range(len(all_negative_words_list)): + if(random.randint(1, 100) 2): + counttotal = int(count/2) + if(counttotal > 3): + counttotal = 3 + unique_words.append(f"({word}:1.{counttotal})") + else: + unique_words.append(word) + + negative_result = ", ".join(unique_words) - print(negative_primer) - print(negative_result) return negative_result def replace_match(match): @@ -3928,3 +3939,34 @@ def parse_custom_functions(completeprompt, insanitylevel = 5): return completeprompt + +def split_prompt_to_words(text): + # first get all the words + + # Split the string by commas and spaces + words = re.split(r'[,\s]+', text) + # Remove leading/trailing whitespaces from each word + words = [word.strip() for word in words] + + # Filter out empty words + words = [word for word in words if word] + + # Convert the list to a set to remove duplicates, then convert it back to a list + listsinglewords = list(set(words)) + + # now get all words clumped together by commas + if ',' in text: + allwords = text.split(',') + else: + allwords = [text] + # Remove leading/trailing whitespaces from each word and convert to lowercase + words = [word.strip().lower() for word in allwords] + + # Filter out empty words and duplicates + listwords = list(set(filter(None, words))) + + totallist = listsinglewords + listwords + + totallist = list(set(filter(None, totallist))) + + return totallist \ No newline at end of file diff --git a/csv_reader.py b/csv_reader.py index ee71719..e3466b8 100644 --- a/csv_reader.py +++ b/csv_reader.py @@ -158,4 +158,22 @@ def load_config_csv(): reader = csv.DictReader(file, delimiter=";") csvlist = [list(row.values()) for row in reader if not any(value.startswith('#') for value in row.values())] return csvlist + +def load_negative_list(): + primerlist = [] + negativelist = [] + script_dir = os.path.dirname(os.path.abspath(__file__)) + + full_path_default_negative_file = os.path.join(script_dir, "./csvfiles/special_lists/" ) + negative_file = full_path_default_negative_file + 'negativewords.csv' + + with open(negative_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=";") + primerlist = [row["primer"] for row in reader] + with open(negative_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=";") + negativelist = [row["negative"] for row in reader] + + return primerlist, negativelist + \ No newline at end of file diff --git a/csvfiles/card_names.csv b/csvfiles/card_names.csv index 8aa0a96..d7c55ef 100644 --- a/csvfiles/card_names.csv +++ b/csvfiles/card_names.csv @@ -20481,4 +20481,411 @@ Corporate Archives;terraforming mars Double Down;terraforming mars Head Start;terraforming mars 16 Psyche;terraforming mars -Robot Pollinators;terraforming mars \ No newline at end of file +Robot Pollinators;terraforming mars +Pickaxe;Lost Ruins of Arnak +Bow and Arrows;Lost Ruins of Arnak +Hat;Lost Ruins of Arnak +Trowel;Lost Ruins of Arnak +Gold Pan;Lost Ruins of Arnak +Sturdy Boots;Lost Ruins of Arnak +Brush;Lost Ruins of Arnak +Dog;Lost Ruins of Arnak +Fishing Rod;Lost Ruins of Arnak +Chronometer;Lost Ruins of Arnak +Aeroplane;Lost Ruins of Arnak +Theodolite;Lost Ruins of Arnak +Carrier Pidgeon;Lost Ruins of Arnak +Torch;Lost Ruins of Arnak +Axe;Lost Ruins of Arnak +Parrot;Lost Ruins of Arnak +Watch;Lost Ruins of Arnak +Horse;Lost Ruins of Arnak +Precision Compass;Lost Ruins of Arnak +Tent;Lost Ruins of Arnak +Rope;Lost Ruins of Arnak +Automobile;Lost Ruins of Arnak +Steam Boat;Lost Ruins of Arnak +Machete;Lost Ruins of Arnak +Binoculars;Lost Ruins of Arnak +Rough Map;Lost Ruins of Arnak +Pack Donkey;Lost Ruins of Arnak +Ostrich;Lost Ruins of Arnak +Sea Turtle;Lost Ruins of Arnak +Lantern;Lost Ruins of Arnak +Large Backpack;Lost Ruins of Arnak +Army Knife;Lost Ruins of Arnak +Revolver;Lost Ruins of Arnak +Grappling Hook;Lost Ruins of Arnak +Airdrop;Lost Ruins of Arnak +Flask;Lost Ruins of Arnak +Hot Air Balloon;Lost Ruins of Arnak +Whip;Lost Ruins of Arnak +Bear Trap;Lost Ruins of Arnak +Journal;Lost Ruins of Arnak +Guiding Skull;Lost Ruins of Arnak +Guardian's Crown;Lost Ruins of Arnak +Guardian's Ocarina;Lost Ruins of Arnak +Star Charts;Lost Ruins of Arnak +War Club;Lost Ruins of Arnak +Guiding Stone;Lost Ruins of Arnak +Hunting Arrows;Lost Ruins of Arnak +Idol of Ara-Ana;Lost Ruins of Arnak +Passage Shell;Lost Ruins of Arnak +Tigerclaw Hairpin;Lost Ruins of Arnak +Ritual Dagger;Lost Ruins of Arnak +Trader's Scales;Lost Ruins of Arnak +Ancient Wine;Lost Ruins of Arnak +Coconut Flask;Lost Ruins of Arnak +Sacred Drum;Lost Ruins of Arnak +Runes of the Dead;Lost Ruins of Arnak +Pathfinder's Staff;Lost Ruins of Arnak +Monkey Medallion;Lost Ruins of Arnak +Ornate Hammer;Lost Ruins of Arnak +Inscribed Blade;Lost Ruins of Arnak +Sundial;Lost Ruins of Arnak +Mortar;Lost Ruins of Arnak +Cleansing Cauldron;Lost Ruins of Arnak +Trader's Coins;Lost Ruins of Arnak +Stone Key;Lost Ruins of Arnak +Decorated Horn;Lost Ruins of Arnak +Serpent Idol;Lost Ruins of Arnak +Treasure Chest;Lost Ruins of Arnak +War Mask;Lost Ruins of Arnak +Pathfinder's Sandals;Lost Ruins of Arnak +Ceremonial Rattle;Lost Ruins of Arnak +Serpent's Gold;Lost Ruins of Arnak +Crystal Earring;Lost Ruins of Arnak +Obsidian Earring;Lost Ruins of Arnak +Stone Jar;Lost Ruins of Arnak +Coin;Lost Ruins of Arnak +Compass;Lost Ruins of Arnak +Tablet;Lost Ruins of Arnak +Arrowhead;Lost Ruins of Arnak +Jewel;Lost Ruins of Arnak +Boot;Lost Ruins of Arnak +Automobile;Lost Ruins of Arnak +Boat;Lost Ruins of Arnak +Airplane;Lost Ruins of Arnak +Exile;Lost Ruins of Arnak +Campsite;Lost Ruins of Arnak +Idol;Lost Ruins of Arnak +Silver Assistant;Lost Ruins of Arnak +Gold Assistant;Lost Ruins of Arnak +The Magician;Tarot +The High Priestess;Tarot +The Empress;Tarot +The Emperor;Tarot +The Hierophant;Tarot +The Lovers;Tarot +The Chariot;Tarot +Strength;Tarot +The Hermit;Tarot +Wheel Of Fortune;Tarot +Justice;Tarot +The Hanged Man;Tarot +Death;Tarot +Temperance;Tarot +The Devil;Tarot +The Tower;Tarot +The Star;Tarot +The Moon;Tarot +The Sun;Tarot +Judgment;Tarot +The Fool;Tarot +The World;Tarot +"Princess" Yuna Moritani;Dune Imperium +Advanced Weaponry;Dune Imperium +Allied Armada;Dune Imperium +Ambush;Dune Imperium +Appropriate;Dune Imperium +Archduke Armand Ecaz;Dune Imperium +Arrakis Recruiter;Dune Imperium +Artillery;Dune Imperium +Assassination Mission;Dune Imperium +Baron Vladimir Harkonnen;Dune Imperium +Battle for Arakeen;Dune Imperium +Battle for Carthag;Dune Imperium +Battle for Imperial Basin;Dune Imperium +Beguiling Pheromones;Dune Imperium +Bene Gesserit Initiate;Dune Imperium +Bene Gesserit Sister;Dune Imperium +Bene Tleilax Lab;Dune Imperium +Bene Tleilax Researcher;Dune Imperium +Bindu Suspension;Dune Imperium +Blackmail;Dune Imperium +Blank Slate;Dune Imperium +Boundless Ambition;Dune Imperium +Bounty Hunter;Dune Imperium +Breakthrough;Dune Imperium +Bribery;Dune Imperium +Bypass Protocol;Dune Imperium +Calculated Hire;Dune Imperium +Cannon Turrets;Dune Imperium +Carryall;Dune Imperium +Chairdog;Dune Imperium +Chani;Dune Imperium +Charisma;Dune Imperium +Chaumurky;Dune Imperium +CHOAM Delegate;Dune Imperium +CHOAM Directorship;Dune Imperium +CHOAM shares;Dune Imperium +Chrysknife;Dune Imperium +Clandestine Meeting;Dune Imperium +Cloak and Dagger;Dune Imperium +Contaminator;Dune Imperium +Corner the Market;Dune Imperium +Corrino Genes;Dune Imperium +Corrupt Smuggler;Dune Imperium +Councilor's Dispensation;Dune Imperium +Count Ilban Richese;Dune Imperium +Counterattack;Dune Imperium +Countess Ariana Thorvald;Dune Imperium +Court Intrigue;Dune Imperium +Cull;Dune Imperium +Demand Respect;Dune Imperium +Desert Ambush;Dune Imperium +Desert Power;Dune Imperium +Detonation Devices;Dune Imperium +Disguised Beaurocrat;Dune Imperium +Dispatch an Envoy;Dune Imperium +Disposal Facility;Dune Imperium +Dissecting Kit;Dune Imperium +Diversion;Dune Imperium +Double Cross;Dune Imperium +Dr. Yueh;Dune Imperium +Duke Leto Atreides;Dune Imperium +Duncan Idaho;Dune Imperium +Duncan Loyal Blade;Dune Imperium +Earl Memnon Thorvald;Dune Imperium +Economic Positioning;Dune Imperium +Economic Supremacy;Dune Imperium +Embedded Agent;Dune Imperium +Esmar Tuek;Dune Imperium +Expedite;Dune Imperium +Face Dancer;Dune Imperium +Face Dancer Initiate;Dune Imperium +Favored Subject;Dune Imperium +Fedaykin Death Commando;Dune Imperium +Finesse;Dune Imperium +Firm Grip;Dune Imperium +Flagship;Dune Imperium +For Humanity;Dune Imperium +Freighter Fleet;Dune Imperium +Fremen Camp;Dune Imperium +From the Tanks;Dune Imperium +Full-Scale Assault;Dune Imperium +Gene Manipulation;Dune Imperium +Ghola;Dune Imperium +Glimpse the Path;Dune Imperium +Glossu "The Beast" Rabban;Dune Imperium +Grand Conspiracy;Dune Imperium +Grand Vision;Dune Imperium +Gruesome Sacrificee;Dune Imperium +Guild Accord;Dune Imperium +Guild Administrator;Dune Imperium +Guild Ambassador;Dune Imperium +Guild Authorization;Dune Imperium +Guild Bank Raid;Dune Imperium +Guild Bankers;Dune Imperium +Guild Chief Administrator;Dune Imperium +Guild Impersonator;Dune Imperium +Gun Thopter;Dune Imperium +Gurney Halleck;Dune Imperium +Harvest Cells;Dune Imperium +Helena Richese;Dune Imperium +High Priority Travel;Dune Imperium +Holoprojectors;Dune Imperium +Holtzman Engine;Dune Imperium +Ilesa EcazA18;Dune Imperium +Illicit Dealings;Dune Imperium +Imperial Bashar;Dune Imperium +Imperial Shock Trooper;Dune Imperium +Imperial Spy;Dune Imperium +Imperium Ceremony;Dune Imperium +In the Shadows;Dune Imperium +Industrial Espionage;Dune Imperium +Infiltrate;Dune Imperium +Interstellar Conspiracy;Dune Imperium +Invasion Ships;Dune Imperium +Ix-Guild Compact;Dune Imperium +Ixian Engineer;Dune Imperium +Ixian Probe;Dune Imperium +Jamis;Dune Imperium +Jessica of Arrakis;Dune Imperium +Keys to Power;Dune Imperium +Know Their Ways;Dune Imperium +Kwisatz Haderach;Dune Imperium +Lady Jessica;Dune Imperium +Landing Rights;Dune Imperium +Liet Kynes;Dune Imperium +Lisan Al Gaib;Dune Imperium +Local Fence;Dune Imperium +Long Reach;Dune Imperium +Machinaitions;Dune Imperium +Machine Culture;Dune Imperium +Master Tactician;Dune Imperium +Memocorders;Dune Imperium +Minimic Film;Dune Imperium +Missionaria Protectiva;Dune Imperium +Negotiated Withdrawel;Dune Imperium +Occupation;Dune Imperium +Opulence;Dune Imperium +Organ Merchants;Dune Imperium +Other Memory;Dune Imperium +Paul Atreides;Dune Imperium +Peter De Vries;Dune Imperium +Piter, Genius Advisor;Dune Imperium +Planned Coupling;Dune Imperium +Plans within Plans;Dune Imperium +Poison Snooper;Dune Imperium +Power Play;Dune Imperium +Prince Rhombur Vernius;Dune Imperium +Private Army;Dune Imperium +Quid Pro Quo;Dune Imperium +Raid Stockpiles;Dune Imperium +Rapid Mobilization;Dune Imperium +Reclaimed Forces;Dune Imperium +Recruitment Mission;Dune Imperium +Refocus;Dune Imperium +Reinforcements;Dune Imperium +Replacement Eyes;Dune Imperium +Restricted Ordinance;Dune Imperium +Reverend Mother Mohaim;Dune Imperium +Sardukar Infantry;Dune Imperium +Sardukar Legion;Dune Imperium +Sardukar Quartermaster;Dune Imperium +Satellite Ban;Dune Imperium +Sayyadina;Dune Imperium +Scientific Breakthrough;Dune Imperium +Scout;Dune Imperium +Second Wave;Dune Imperium +Secret Forces;Dune Imperium +Secret of the Sisterhood;Dune Imperium +Secure Imperial Basin;Dune Imperium +Shadout Mapes;Dune Imperium +Shadowy bargain;Dune Imperium +Shai-Hulud;Dune Imperium +Shifting Allegiancs;Dune Imperium +Show of Strength;Dune Imperium +Shuttle Fleet;Dune Imperium +Siege of Arakeen;Dune Imperium +Siege of Carthag;Dune Imperium +Sietch Reverend Mother;Dune Imperium +Skirmish;Dune Imperium +Slig Farmer;Dune Imperium +Smuggler's Thopter;Dune Imperium +Sonic Snoopers;Dune Imperium +Sort Through The Chaos;Dune Imperium +Space Travel;Dune Imperium +Spaceport;Dune Imperium +Spice Hunter;Dune Imperium +Spice Smugglers;Dune Imperium +Spice Trader;Dune Imperium +Spiritual Ferver;Dune Imperium +Spy Satellites;Dune Imperium +Staged Incident;Dune Imperium +Stilgar;Dune Imperium +Stillsuit Manufacture;Dune Imperiumr +Stitched Horror;Dune Imperium +Strategic Push;Dune Imperium +Strongarm;Dune Imperium +Study Melange;Dune Imperium +Subject X-137;Dune Imperium +Terrible Purpose;Dune Imperium +Tessia Vernius;Dune Imperium +Test of Humanity;Dune Imperium +The Sleeper Must Awaken;Dune Imperium +The Voice;Dune Imperium +Throne Room Politics;Dune Imperium +Thufir Hawat;Dune Imperium +Thumper;Dune Imperium +Tiebreaker;Dune Imperium +Tleilaxu Infiltrator;Dune Imperium +Tleilaxu Master;Dune Imperium +Tleilaxu Puppet;Dune Imperium +Tleilaxu Surgeon;Dune Imperium +To the Victor…;Dune Imperium +Trade Monopoly;Dune Imperium +Training Drones;Dune Imperium +Treachery;Dune Imperium +Troop Transports;Dune Imperium +Truthsayer;Dune Imperium +Twisted Mentat;Dune Imperium +Unnatural Reflexes;Dune Imperium +Urgent Mission;Dune Imperium +Usurp;Dune Imperium +Vicious Talents;Dune Imperium +Viscount Hudro Moritani;Dune Imperium +War Chest;Dune Imperium +Water of Life;Dune Imperium +Water Peddler;Dune Imperium +Water Peddlers Union;Dune Imperium +Web of Power;Dune Imperium +Weirding Way;Dune Imperium +Windfall;Dune Imperium +Windtraps;Dune Imperium +Worm Riders;Dune Imperium +Acid Attack;King of Tokyo +Alien Metabolism;King of Tokyo +Alpha Monster;King of Tokyo +Apartment Building;King of Tokyo +Armor Plating;King of Tokyo +Background Dweller;King of Tokyo +Burrowing;King of Tokyo +Camouflage;King of Tokyo +Commuter Train;King of Tokyo +Complete Destruction;King of Tokyo +Corner Store;King of Tokyo +Dedicated News Team;King of Tokyo +Drop from High Altitude;King of Tokyo +Eater of the Dead;King of Tokyo +Energize;King of Tokyo +Energy Hoarder;King of Tokyo +Evacuation Orders;King of Tokyo +Even Bigger;King of Tokyo +Extra Head;King of Tokyo +Fire Blast;King of Tokyo +Fire Breathing;King of Tokyo +Freeze Time;King of Tokyo +Frenzy;King of Tokyo +Friend of Children;King of Tokyo +Gas Refinery;King of Tokyo +Giant Brain;King of Tokyo +Gourmet;King of Tokyo +Heal;King of Tokyo +Healing Ray;King of Tokyo +Herbivore;King of Tokyo +Herd Culler;King of Tokyo +High Altitude Bombing;King of Tokyo +It Has a Child;King of Tokyo +Jet Fighters;King of Tokyo +Jets;King of Tokyo +Made in a Lab;King of Tokyo +Metamorph;King of Tokyo +Mimic;King of Tokyo +Monster Batteries;King of Tokyo +National Guard;King of Tokyo +Nova Breath;King of Tokyo +Nuclear Power Plant;King of Tokyo +Omnivore;King of Tokyo +Opportunist;King of Tokyo +Parasitic Tentacles;King of Tokyo +Plot Twist;King of Tokyo +Poison Quills;King of Tokyo +Poison Spit;King of Tokyo +Psychic Probe;King of Tokyo +Rapid Healing;King of Tokyo +Regeneration;King of Tokyo +Rooting for the Underdog;King of Tokyo +Shrink Ray;King of Tokyo +Skyscraper;King of Tokyo +Smoke Cloud;King of Tokyo +Solar Powered;King of Tokyo +Spiked Tail;King of Tokyo +Stretchy;King of Tokyo +Tanks;King of Tokyo +Telepath;King of Tokyo +Urbavore;King of Tokyo +Vast Storm;King of Tokyo +We're Only Making It Stronger;King of Tokyo +Wings;King of Tokyo \ No newline at end of file diff --git a/csvfiles/special_lists/negativewords.csv b/csvfiles/special_lists/negativewords.csv index 3d2d354..950d4dc 100644 --- a/csvfiles/special_lists/negativewords.csv +++ b/csvfiles/special_lists/negativewords.csv @@ -1,2 +1,110 @@ -manga, anime;photograph, realism, realistic -architecture; painting, illustration \ No newline at end of file +primer;negative +photo;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration +photograph;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration +photographic;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration +cinematic;painting,surrealism,camera,anime,cartoon,abstract,illustration +film grain;painting,surrealism,camera,anime,cartoon,abstract,illustration +sharp;bokeh,blurry,blur +abstract;photograph, realism, photorealism,plain, simple, monochrome +expressionism;photograph, photorealism, low contrast +manga;photograph, realism, photorealism, worst quality, low quality, western +anime;photograph, realism, photorealism, worst quality, low quality, western +architecture;painting, illustration +3D;photograph, realism, photorealism, low contrast, low poly +render;photograph, realism, photorealism, low contrast, low poly +kawaii;gothic, dark, moody, monochromatic, ugly, western +adorable;gothic, dark, moody, monochromatic, ugly +cute;gothic, dark, moody, monochromatic, ugly +art deco;low contrast, photorealism, modernist, minimalist +art nouveau;low contrast, industrial, mechanical, photorealism, modernist, minimalist +renaissance;low contrast, photorealism, modernist, minimalist +baroque;low contrast, photorealism, modernist, minimalist +caricature;realism +dark fantasy;bright, sunny, light, vibrant, colorful +dark;bright, sunny, light, vibrant, colorful +darkness;bright, sunny, light, vibrant, colorful +moody;bright, sunny, light, vibrant, colorful +goth;bright, sunny, light, vibrant, colorful +gothic;bright, sunny, light, vibrant, colorful +macabre;bright, sunny, light, vibrant, colorful +grim;bright, sunny, light, vibrant, colorful +faded;bright, sunny, light, vibrant, colorful +noir;bright, sunny, light, vibrant, colorful +horror;bright, sunny, light, vibrant, colorful +fortnite;photograph, realism, photorealism +ink;bright, sunny, light, vibrant, colorful +light;dark, moody, night, monochromatic, washed out +happy;dark, moody, night, monochromatic, washed out +joy;dark, moody, night, monochromatic, washed out +vibrant;dark, moody, night, monochromatic, washed out +neon;moody, monochromatic, washed out +monochrome;colorful, vibrant +drawing;photograph, photorealism +graffiti;photograph, photorealism +impressionism;photograph, photorealism,anime +impressionist;photograph, photorealism,anime +pop art;photograph, photorealism +vector;photograph, photorealism +surrealism;photograph, realism, photorealism +surrealist;photograph, realism, photorealism +suprematism;realism +watercolor;photograph, photorealism +watercolour;photograph, photorealism +whymsical;drab, boring, moody +masterpiece;cropped, worst quality, low quality, poorly drawn, low resolution +quality;cropped, worst quality, low quality, poorly drawn, low resolution +sketch;photograph, realism, photorealism +artistic;insignificant, flawed, made by bad artist, low quality, low resolution +dynamic;still life,static, still, slow, boring, standing still, calm, peaceful +undead;alive +painting;drawing,sketch,frame,watermark +comic;photograph, realism, photorealism,frame,watermark +illustration;photograph, realism, photorealism,frame,watermark +clay;photograph, realism, photorealism,sloppy, messy +digital;photograph, photorealism +fantasy;photograph, realism, photorealism, modern, ordinary, mundane +fairy tale;photograph, realism, photorealism, modern, ordinary, mundane +magical realism;modern, ordinary, mundane +magical;modern, ordinary, mundane +magic;modern, ordinary, mundane +isometric;photograph, realism, photorealism +line art;painting,abstract,camera,anime,cartoon,sketch,3d,render +pixel;photograph, realism, photorealism, painting,abstract,camera,anime,cartoon,sketch,3d,render +pixel-art;photograph, realism, photorealism, painting,abstract,camera,anime,cartoon,sketch,3d,render +professional;amateurish, sloppy, unattractive +advertisement;amateurish, sloppy, unattractive +advertising;amateurish, sloppy, unattractive +commercial;amateurish, sloppy, unattractive +corporate;amateurish, sloppy, unattractive +fashion;amateurish, sloppy, unattractive, baggy, cheap, trash +luxury;amateurish, sloppy, unattractive, baggy, cheap, trash +hyperrealistic;simple, plain, abstract, unrealistic, impressionistic, low resolution,surrealism +hyperrealism;simple, plain, abstract, unrealistic, impressionistic, low resolution,surrealism +pointillism;line drawing, smooth shading, large color fields, simplistic +psychedelic;photograph, realism, photorealism,plain, simple, monochrome +biomechanical;natural, rustic, primitive, organic, simplistic +futuristic;natural, rustic, primitive, organic, simplistic +cybernetic;natural, rustic, primitive, organic, simplistic +cyberpunk;natural, rustic, primitive, organic, simplistic +technology;natural, rustic, primitive, organic, simplistic +retro;modern +vintage;modern +modern;retro, vintage +sci-fi;historical +sci fi;historical +scifi;historical +science fiction;historical +game art;photograph, photorealism, low contrast +dream;ordinary, mundane +dreamy;ordinary, mundane +minimalist;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism +minimalism;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism +detailed;simplistic,minimalism, plain, simple +papercut;3D, high detail, painting, drawing, photo +paper;3D, high detail, painting, drawing, photo +kirigami;3D, high detail, painting, drawing, photo +alien;earthly, mundane, common, realistic, simple +winter;summer +summer;winter +industrial;organic +bokeh;sharp,focus \ No newline at end of file diff --git a/negativeprompttester.py b/negativeprompttester.py index ac6dd4d..13abdf7 100644 --- a/negativeprompttester.py +++ b/negativeprompttester.py @@ -17,7 +17,10 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="5"): insanitylevel = int(insanitylevel) while steps < loops: # build prompt + if positive_prompt == "": + positive_prompt = build_dynamic_prompt() result = build_dynamic_negative(postive_prompt=positive_prompt, insanitylevel=insanitylevel) + print(result) print("") print("loop " + str(steps)) print("") @@ -29,4 +32,4 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="5"): print("") print("All done!") -generateprompts(1,"",5) \ No newline at end of file +generateprompts(1,"",1) \ No newline at end of file From d93d19dc7aafa6971c4d6a75774de1a3df654466 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Mon, 1 Jan 2024 08:11:42 +0100 Subject: [PATCH 04/10] decent version of auto negative --- OneButtonPromptNodes.py | 56 +++++++- build_dynamic_prompt.py | 42 +++++- csv_reader.py | 17 +++ csvfiles/special_lists/negativewords.csv | 174 ++++++++++++++++++++--- negativeprompttester.py | 8 +- 5 files changed, 270 insertions(+), 27 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index c30b5d1..d63d1c5 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -435,12 +435,66 @@ class SavePromptToFile: return ("done") +class AutoNegativePrompt: + + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(s): + + return { + "required": { + "postive_prompt": ("STRING", {"default": '', "multiline": True}), + }, + "optional": { + "insanitylevel": ("INT", { + "default": 0, + "min": 0, #Minimum value + "max": 10, #Maximum value + "step": 1 #Slider's step + }), + "base_negative": ("STRING", { + "multiline": True, #True if you want the field to look like the one on the ClipTextEncode node + "default": "text, watermark" + }), + "enhancenegative": ("INT", { + "default": 1, + "min": 0, #Minimum value + "max": 1, #Maximum value + "step": 1, #Slider's step + }), + + "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), + }, + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("negative_prompt",) + + FUNCTION = "Comfy_OBP_AutoNegativePrompt" + + #OUTPUT_NODE = False + + CATEGORY = "OneButtonPrompt" + + def Comfy_OBP_AutoNegativePrompt(self, postive_prompt, insanitylevel, enhancenegative,base_negative, seed): + generatedprompt = build_dynamic_negative(postive_prompt, insanitylevel, enhancenegative, base_negative) + + print("Generated negative prompt: " + generatedprompt) + + return (generatedprompt,) + + + # A dictionary that contains all nodes you want to export with their names # NOTE: names should be globally unique NODE_CLASS_MAPPINGS = { "OneButtonPrompt": OneButtonPrompt, "CreatePromptVariant": CreatePromptVariant, - "SavePromptToFile": SavePromptToFile + "SavePromptToFile": SavePromptToFile, + "AutoNegativePrompt": AutoNegativePrompt, } # A dictionary that contains the friendly/humanly readable titles for the nodes diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 5c80676..36c0a5a 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -3686,7 +3686,7 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy return completeprompt -def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): +def build_dynamic_negative(positive_prompt = "", insanitylevel = 0, enhance = False, existing_negative_prompt = ""): negative_primer = [] @@ -3697,16 +3697,38 @@ def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): # the negative words to put in the negative prompt negative_primer, negative_result = load_negative_list() - allwords = split_prompt_to_words(postive_prompt) + # do a trick for artists, replace with their tags instead + artistlist, categorylist = load_all_artist_and_category() + # lower them + artist_names = [artist.strip().lower() for artist in artistlist] + + # note, should we find a trick for some shorthands of artists?? + + for artist_name, category in zip(artist_names, categorylist): + positive_prompt = positive_prompt.lower().replace(artist_name, category) + + + allwords = split_prompt_to_words(positive_prompt) + + + #lower all! for word in allwords: - if(word in negative_primer): - index_of_word = negative_primer.index(word) + if(word.lower() in negative_primer): + index_of_word = negative_primer.index(word.lower()) all_negative_words_list.append(negative_result[index_of_word]) all_negative_words = ", ".join(all_negative_words_list) all_negative_words_list = all_negative_words.split(",") all_negative_words_list = [elem.strip().lower() for elem in all_negative_words_list] + + + + + + if enhance == True: + enhancelist = ["worst quality", "low quality", "normal quality", "lowres", "low details", "oversaturated", "undersaturated", "overexposed", "underexposed", "grayscale", "bw", "bad photo", "bad photography", "bad art", "watermark", "signature", "text font", "username", "error", "logo", "words", "letters", "digits", "autograph", "trademark", "name", "blur", "blurry", "grainy", "ugly", "asymmetrical", "poorly lit", "bad shadow", "draft", "cropped", "out of frame", "cut off", "censored", "jpeg artifacts", "out of focus", "glitch", "duplicate"] + all_negative_words_list += enhancelist # new lets remove some based on the reverse insanitylevel @@ -3716,6 +3738,10 @@ def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): if(random.randint(1, 100) 2): - counttotal = int(count/2) + #counttotal = int(count/2) + counttotal = count if(counttotal > 3): counttotal = 3 unique_words.append(f"({word}:1.{counttotal})") @@ -3738,6 +3765,8 @@ def build_dynamic_negative(postive_prompt = "", insanitylevel = 5): negative_result = ", ".join(unique_words) + negative_result += ", " + existing_negative_prompt + return negative_result def replace_match(match): @@ -3943,6 +3972,9 @@ def parse_custom_functions(completeprompt, insanitylevel = 5): def split_prompt_to_words(text): # first get all the words + # Use a regular expression to replace non-alphabetic characters with spaces + text = re.sub(r'[^a-zA-Z,-]', ' ', text) + # Split the string by commas and spaces words = re.split(r'[,\s]+', text) # Remove leading/trailing whitespaces from each word diff --git a/csv_reader.py b/csv_reader.py index e3466b8..5438880 100644 --- a/csv_reader.py +++ b/csv_reader.py @@ -176,4 +176,21 @@ def load_negative_list(): return primerlist, negativelist +def load_all_artist_and_category(): + artistlist = [] + categorylist = [] + script_dir = os.path.dirname(os.path.abspath(__file__)) + + full_path_default_artist_file = os.path.join(script_dir, "./csvfiles/" ) + artist_file = full_path_default_artist_file + 'artists_and_category.csv' + + with open(artist_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=",") + artistlist = [row["Artist"] for row in reader] + with open(artist_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=",") + categorylist = [row["Tags"] for row in reader] + + return artistlist, categorylist + \ No newline at end of file diff --git a/csvfiles/special_lists/negativewords.csv b/csvfiles/special_lists/negativewords.csv index 950d4dc..8bb50ed 100644 --- a/csvfiles/special_lists/negativewords.csv +++ b/csvfiles/special_lists/negativewords.csv @@ -3,40 +3,73 @@ photo;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration photograph;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration photographic;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration cinematic;painting,surrealism,camera,anime,cartoon,abstract,illustration +cinema;painting,surrealism,camera,anime,cartoon,abstract,illustration +cinestill;painting,surrealism,camera,anime,cartoon,abstract,illustration +movie still;painting,surrealism,camera,anime,cartoon,abstract,illustration film grain;painting,surrealism,camera,anime,cartoon,abstract,illustration +stylized;photorealism sharp;bokeh,blurry,blur +focus;bokeh,blurry,blur +focussed;bokeh,blurry,blur abstract;photograph, realism, photorealism,plain, simple, monochrome +cubism;photograph, realism, photorealism,plain, simple expressionism;photograph, photorealism, low contrast -manga;photograph, realism, photorealism, worst quality, low quality, western -anime;photograph, realism, photorealism, worst quality, low quality, western +manga;photograph, realism, photorealism, worst quality, low quality, western cartoon +anime;photograph, realism, photorealism, worst quality, low quality, western cartoon +cartoon;photograph, realism, photorealism, worst quality, low quality, manga +melanin;photograph, realism, photorealism +children's illustration;photograph, realism, photorealism, worst quality, low quality, nsfw, ugly architecture;painting, illustration 3D;photograph, realism, photorealism, low contrast, low poly +pixar;photograph, realism, photorealism, low contrast, low poly +octane;photograph, realism, photorealism, low contrast, low poly +unreal engine;photograph, realism, photorealism, low contrast, low poly render;photograph, realism, photorealism, low contrast, low poly -kawaii;gothic, dark, moody, monochromatic, ugly, western -adorable;gothic, dark, moody, monochromatic, ugly -cute;gothic, dark, moody, monochromatic, ugly +kawaii;gothic, dark, moody, monochromatic, ugly, gritty, western cartoon +chibi;gothic, dark, moody, monochromatic, ugly, gritty, western cartoon +adorable;gothic, dark, moody, monochromatic, ugly, gritty +cute;gothic, dark, moody, monochromatic, ugly, gritty +cutecore;gothic, dark, moody, monochromatic, ugly, gritty art deco;low contrast, photorealism, modernist, minimalist art nouveau;low contrast, industrial, mechanical, photorealism, modernist, minimalist renaissance;low contrast, photorealism, modernist, minimalist +romanticism;low contrast, photorealism, modernist, minimalist, moody, dark baroque;low contrast, photorealism, modernist, minimalist +rococo;low contrast, photorealism, modernist, minimalist caricature;realism dark fantasy;bright, sunny, light, vibrant, colorful dark;bright, sunny, light, vibrant, colorful +colorless;vibrant, colorful +one color;vibrant, colorful darkness;bright, sunny, light, vibrant, colorful moody;bright, sunny, light, vibrant, colorful +sad;happy, bright +happy;sad, dark, moody +smile;sad, dark, moody +smiling;sad, dark, moody goth;bright, sunny, light, vibrant, colorful gothic;bright, sunny, light, vibrant, colorful macabre;bright, sunny, light, vibrant, colorful +desolate;bright, sunny, light, vibrant, colorful, people grim;bright, sunny, light, vibrant, colorful faded;bright, sunny, light, vibrant, colorful noir;bright, sunny, light, vibrant, colorful -horror;bright, sunny, light, vibrant, colorful +horror;bright, sunny, light, vibrant, colorful, beautiful, cute +monster;beautiful, cute, adorable +creepy;beautiful, cute, adorable +luminism;monochromatic, washed out fortnite;photograph, realism, photorealism ink;bright, sunny, light, vibrant, colorful light;dark, moody, night, monochromatic, washed out happy;dark, moody, night, monochromatic, washed out joy;dark, moody, night, monochromatic, washed out +joyful;dark, moody, night, monochromatic, washed out vibrant;dark, moody, night, monochromatic, washed out +colorful;dark, moody, night, monochromatic, washed out +colors;dark, moody, night, monochromatic, washed out +colours;dark, moody, night, monochromatic, washed out +colourful;dark, moody, night, monochromatic, washed out +vivid;dark, moody, night, monochromatic, washed out neon;moody, monochromatic, washed out monochrome;colorful, vibrant drawing;photograph, photorealism @@ -49,62 +82,169 @@ surrealism;photograph, realism, photorealism surrealist;photograph, realism, photorealism suprematism;realism watercolor;photograph, photorealism +water color;photograph, photorealism watercolour;photograph, photorealism -whymsical;drab, boring, moody +whymsical;drab, boring, moody, serious, realism +whimsical;drab, boring, moody, serious, realism masterpiece;cropped, worst quality, low quality, poorly drawn, low resolution quality;cropped, worst quality, low quality, poorly drawn, low resolution +artstation;cropped, worst quality, low quality, poorly drawn, low resolution +pixabay;cropped, worst quality, low quality, poorly drawn, low resolution +behance;cropped, worst quality, low quality, poorly drawn, low resolution sketch;photograph, realism, photorealism artistic;insignificant, flawed, made by bad artist, low quality, low resolution -dynamic;still life,static, still, slow, boring, standing still, calm, peaceful +dynamic;still life, static, still, slow, boring, standing still, calm, peaceful +still life;dynamic, action +calm;dynamic, action +boring;dynamic, action undead;alive painting;drawing,sketch,frame,watermark +ukiyo-e;drawing,sketch,frame,watermark comic;photograph, realism, photorealism,frame,watermark +comics;photograph, realism, photorealism,frame,watermark +graphic design;photograph, realism, photorealism,frame,watermark illustration;photograph, realism, photorealism,frame,watermark clay;photograph, realism, photorealism,sloppy, messy digital;photograph, photorealism fantasy;photograph, realism, photorealism, modern, ordinary, mundane +concept;photograph, realism, photorealism, modern, ordinary, mundane fairy tale;photograph, realism, photorealism, modern, ordinary, mundane +fairy-tale;photograph, realism, photorealism, modern, ordinary, mundane magical realism;modern, ordinary, mundane +storybook realism;modern, ordinary, mundane magical;modern, ordinary, mundane magic;modern, ordinary, mundane +ethereal;modern, ordinary, mundane isometric;photograph, realism, photorealism line art;painting,abstract,camera,anime,cartoon,sketch,3d,render pixel;photograph, realism, photorealism, painting,abstract,camera,anime,cartoon,sketch,3d,render pixel-art;photograph, realism, photorealism, painting,abstract,camera,anime,cartoon,sketch,3d,render professional;amateurish, sloppy, unattractive +professionally;amateurish, sloppy, unattractive advertisement;amateurish, sloppy, unattractive advertising;amateurish, sloppy, unattractive commercial;amateurish, sloppy, unattractive corporate;amateurish, sloppy, unattractive -fashion;amateurish, sloppy, unattractive, baggy, cheap, trash -luxury;amateurish, sloppy, unattractive, baggy, cheap, trash +fashion;amateurish, sloppy, unattractive, baggy, cheap, trashy clothing +fauvism;amateurish, sloppy, unattractive, baggy, cheap, trashy clothing +luxury;amateurish, sloppy, unattractive, baggy, cheap, trashy clothing hyperrealistic;simple, plain, abstract, unrealistic, impressionistic, low resolution,surrealism -hyperrealism;simple, plain, abstract, unrealistic, impressionistic, low resolution,surrealism +realistic;simple, plain, abstract, unrealistic, impressionistic, low resolution,surrealism +figurativism;simple, plain, abstract, unrealistic, impressionistic, low resolution, surrealism, symbolism +hyperrealism;simple, plain, abstract, unrealistic, impressionistic, low resolution, surrealism +realism;simple, plain, abstract, unrealistic, impressionistic, low resolution, surrealism +real;simple, plain, abstract, unrealistic, impressionistic, low resolution, surrealism pointillism;line drawing, smooth shading, large color fields, simplistic psychedelic;photograph, realism, photorealism,plain, simple, monochrome biomechanical;natural, rustic, primitive, organic, simplistic futuristic;natural, rustic, primitive, organic, simplistic cybernetic;natural, rustic, primitive, organic, simplistic cyberpunk;natural, rustic, primitive, organic, simplistic +robot;natural, rustic, primitive, organic, simplistic +robotic;natural, rustic, primitive, organic, simplistic technology;natural, rustic, primitive, organic, simplistic +geometric;natural, rustic, primitive, organic, simplistic +angular;natural, rustic, primitive, organic, simplistic +bauhaus;natural, rustic, primitive, organic, simplistic +nature;industrial, mechanical, geometric patterns +nature-inspired;industrial, mechanical, geometric patterns +natural;industrial, mechanical, geometric patterns +floral;industrial, mechanical, geometric patterns +flora;industrial, mechanical, geometric patterns +fauna;industrial, mechanical, geometric patterns +flower;industrial, mechanical, geometric patterns +flowers;industrial, mechanical, geometric patterns +blossoms;industrial, mechanical, geometric patterns +organic;industrial, mechanical, geometric patterns +vegetation;industrial, mechanical, geometric patterns +forest;industrial, mechanical, geometric patterns +trees;industrial, mechanical, geometric patterns +foliage;industrial, mechanical, geometric patterns +overgrown;industrial, mechanical, geometric patterns retro;modern vintage;modern -modern;retro, vintage -sci-fi;historical -sci fi;historical -scifi;historical -science fiction;historical +primitivism;modern, ornate, complicated, highly detailed +primitive;modern, ornate, complicated, highly detailed +modern;retro, vintage, traditional +sci-fi;historical, traditional +sci fi;historical, traditional +scifi;historical, traditional +science fiction;historical, traditional game art;photograph, photorealism, low contrast dream;ordinary, mundane +dreamlike;ordinary, mundane dreamy;ordinary, mundane minimalist;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism +simple;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism +simplistic;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism +clean;cluttered, disordered, messy, noisy minimalism;ornate, complicated, highly detailed, cluttered, disordered, messy, noisy, maximalism detailed;simplistic,minimalism, plain, simple +overdetailed;simplistic,minimalism, plain, simple +details;simplistic,minimalism, plain, simple +complex;simplistic,minimalism, plain, simple +intricate;simplistic,minimalism, plain, simple papercut;3D, high detail, painting, drawing, photo paper;3D, high detail, painting, drawing, photo kirigami;3D, high detail, painting, drawing, photo alien;earthly, mundane, common, realistic, simple +otherworldly;earthly, mundane, common, realistic, simple winter;summer summer;winter +spring;autumn +autumn;spring +fall;spring industrial;organic -bokeh;sharp,focus \ No newline at end of file +bokeh;sharp,focus +depth of field;sharp,focus +dof;sharp,focus +beautiful;ugly, gritty +gorgeous;ugly, gritty +beauty;ugly, gritty +beautifully;ugly, gritty +aestheticism;ugly, gritty, asymetrical, low contrast +aesthetic;ugly, gritty, asymetrical, low contrast +ugly;beautiful, cute +gritty;beautiful, cute +visual novel;photograph, photorealism, low contrast +landscape;portrait,people +cloudscape;portrait,people +streetscape;portrait +portrait;full body shot +close up;full body shot +closeup;full body shot +close-up;full body shot +body shot;portrait +shadow;brightly lit +shadows;brightly lit +messy;clean, simple +scene;lonesome +cityscape;portrait +seascape;portrait,people +character;portrait +high contrast;low contrast, monochromatic +monochromatic;light, vibrant, colorful +monochrome;light, vibrant, colorful +street art;portrait +symbolism;figurativism +low contrast;high contrast +desaturated;vibrant, colorful +saturated;dark, moody, monochromatic +oversaturated;dark, moody, monochromatic +dramatic;plain, well lit, brightly lit +emotions;emotionless, plain, boring +emotinal;emotionless, plain, boring +feeling;emotionless, plain, boring +expressing;emotionless, plain, boring +expressive;emotionless, plain, boring +emotive;emotionless, plain, boring +casual;corporate +traditional;modern, contemporary +formal;casual +candle light;brightly lit +feminine;masculine +masculine;feminine +product photo;cluttered background +product shot;cluttered background +white background;cluttered background +plain background;cluttered background \ No newline at end of file diff --git a/negativeprompttester.py b/negativeprompttester.py index 13abdf7..75e31b2 100644 --- a/negativeprompttester.py +++ b/negativeprompttester.py @@ -10,7 +10,7 @@ from build_dynamic_prompt import * -def generateprompts(amount = 1,positive_prompt = "",insanitylevel="5"): +def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=False,existing_negative_prompt=""): loops = int(amount) # amount of images to generate steps = 0 @@ -19,8 +19,8 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="5"): # build prompt if positive_prompt == "": positive_prompt = build_dynamic_prompt() - result = build_dynamic_negative(postive_prompt=positive_prompt, insanitylevel=insanitylevel) - print(result) + result = build_dynamic_negative(positive_prompt=positive_prompt, insanitylevel=insanitylevel,enhance=enhance, existing_negative_prompt=existing_negative_prompt) + print("negative prompt: " + result) print("") print("loop " + str(steps)) print("") @@ -32,4 +32,4 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="5"): print("") print("All done!") -generateprompts(1,"",1) \ No newline at end of file +generateprompts(1,"",1,False,"") \ No newline at end of file From 425468534b7d2473ef41038ba0141d77312341bb Mon Sep 17 00:00:00 2001 From: AIrjen Date: Mon, 1 Jan 2024 09:25:46 +0100 Subject: [PATCH 05/10] Added the stuff into A1111 --- OneButtonPromptNodes.py | 12 +++---- csvfiles/special_lists/negativewords.csv | 2 +- main.py | 41 +++++++++++++++--------- scripts/onebuttonprompt.py | 33 ++++++++++++++++--- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index d63d1c5..c573e53 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -449,12 +449,6 @@ class AutoNegativePrompt: "postive_prompt": ("STRING", {"default": '', "multiline": True}), }, "optional": { - "insanitylevel": ("INT", { - "default": 0, - "min": 0, #Minimum value - "max": 10, #Maximum value - "step": 1 #Slider's step - }), "base_negative": ("STRING", { "multiline": True, #True if you want the field to look like the one on the ClipTextEncode node "default": "text, watermark" @@ -465,6 +459,12 @@ class AutoNegativePrompt: "max": 1, #Maximum value "step": 1, #Slider's step }), + "insanitylevel": ("INT", { + "default": 0, + "min": 0, #Minimum value + "max": 10, #Maximum value + "step": 1 #Slider's step + }), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, diff --git a/csvfiles/special_lists/negativewords.csv b/csvfiles/special_lists/negativewords.csv index 8bb50ed..8710139 100644 --- a/csvfiles/special_lists/negativewords.csv +++ b/csvfiles/special_lists/negativewords.csv @@ -1,6 +1,7 @@ primer;negative photo;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration photograph;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration +photography;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration photographic;painting,abstract,camera,anime,cartoon,sketch,3d,render,illustration cinematic;painting,surrealism,camera,anime,cartoon,abstract,illustration cinema;painting,surrealism,camera,anime,cartoon,abstract,illustration @@ -60,7 +61,6 @@ creepy;beautiful, cute, adorable luminism;monochromatic, washed out fortnite;photograph, realism, photorealism ink;bright, sunny, light, vibrant, colorful -light;dark, moody, night, monochromatic, washed out happy;dark, moody, night, monochromatic, washed out joy;dark, moody, night, monochromatic, washed out joyful;dark, moody, night, monochromatic, washed out diff --git a/main.py b/main.py index dffca40..a5e580a 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ from call_extras import * from model_lists import * -def generateimages(amount = 1, size = "all",model = "currently selected model",samplingsteps = "40",cfg= "7",hiresfix = True,hiressteps ="0",denoisestrength="0.6",samplingmethod="DPM++ SDE Karras", upscaler="R-ESRGAN 4x+", hiresscale="2",apiurl="http://127.0.0.1:7860",qualitygate=False,quality="7.6",runs="5",insanitylevel="5",subject="all", artist="all", imagetype="all",silentmode=False, workprompt="", antistring="",prefixprompt="", suffixprompt="", negativeprompt="",promptcompounderlevel = "1", seperator="comma", img2imgbatch = "1", img2imgsamplingsteps = "20", img2imgcfg = "7", img2imgsamplingmethod = "DPM++ SDE Karras", img2imgupscaler = "R-ESRGAN 4x+", img2imgmodel = "currently selected model", img2imgactivate = False, img2imgscale = "2", img2imgpadding = "64",img2imgdenoisestrength="0.3",ultimatesdupscale=False,usdutilewidth = "512", usdutileheight = "0", usdumaskblur = "8", usduredraw ="Linear", usduSeamsfix = "None", usdusdenoise = "0.35", usduswidth = "64", usduspadding ="32", usdusmaskblur = "8",controlnetenabled=False, controlnetmodel="",img2imgdenoisestrengthmod="-0.05",enableextraupscale = False,controlnetblockymode = False,extrasupscaler1 = "all",extrasupscaler2 ="all",extrasupscaler2visiblity="0.5",extrasupscaler2gfpgan="0",extrasupscaler2codeformer="0.15",extrasupscaler2codeformerweight="0.1",extrasresize="2",onlyupscale="false",givensubject="",smartsubject=True,giventypeofimage="",imagemodechance=20, gender="all", chosensubjectsubtypeobject="all", chosensubjectsubtypehumanoid="all", chosensubjectsubtypeconcept="all", increasestability = False, qualityhiresfix = False, qualitymode = "highest", qualitykeep="keep used", basesize = "512", promptvariantinsanitylevel = 0, givenoutfit = ""): +def generateimages(amount = 1, size = "all",model = "currently selected model",samplingsteps = "40",cfg= "7",hiresfix = True,hiressteps ="0",denoisestrength="0.6",samplingmethod="DPM++ SDE Karras", upscaler="R-ESRGAN 4x+", hiresscale="2",apiurl="http://127.0.0.1:7860",qualitygate=False,quality="7.6",runs="5",insanitylevel="5",subject="all", artist="all", imagetype="all",silentmode=False, workprompt="", antistring="",prefixprompt="", suffixprompt="", negativeprompt="",promptcompounderlevel = "1", seperator="comma", img2imgbatch = "1", img2imgsamplingsteps = "20", img2imgcfg = "7", img2imgsamplingmethod = "DPM++ SDE Karras", img2imgupscaler = "R-ESRGAN 4x+", img2imgmodel = "currently selected model", img2imgactivate = False, img2imgscale = "2", img2imgpadding = "64",img2imgdenoisestrength="0.3",ultimatesdupscale=False,usdutilewidth = "512", usdutileheight = "0", usdumaskblur = "8", usduredraw ="Linear", usduSeamsfix = "None", usdusdenoise = "0.35", usduswidth = "64", usduspadding ="32", usdusmaskblur = "8",controlnetenabled=False, controlnetmodel="",img2imgdenoisestrengthmod="-0.05",enableextraupscale = False,controlnetblockymode = False,extrasupscaler1 = "all",extrasupscaler2 ="all",extrasupscaler2visiblity="0.5",extrasupscaler2gfpgan="0",extrasupscaler2codeformer="0.15",extrasupscaler2codeformerweight="0.1",extrasresize="2",onlyupscale="false",givensubject="",smartsubject=True,giventypeofimage="",imagemodechance=20, gender="all", chosensubjectsubtypeobject="all", chosensubjectsubtypehumanoid="all", chosensubjectsubtypeconcept="all", increasestability = False, qualityhiresfix = False, qualitymode = "highest", qualitykeep="keep used", basesize = "512", promptvariantinsanitylevel = 0, givenoutfit = "", autonegativeprompt = True, autonegativepromptstrength = 0, autonegativepromptenhance = False): loops = int(amount) # amount of images to generate steps = 0 upscalefilelist=[] @@ -22,10 +22,13 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s randomprompt = "" filename="" continuewithnextpart = True + randomsubject = "" originalmodel = model originalsamplingmethod = samplingmethod + originalnegativeprompt = negativeprompt + originalimg2imgmodel = img2imgmodel originalimg2imgsamplingmethod = img2imgsamplingmethod originalimg2imgupscaler = img2imgupscaler @@ -133,23 +136,31 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s else: - randomprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, False,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit) + randompromptlist = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, False,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit, prompt_g_and_l=True) + randomprompt = randompromptlist[0] + randomsubject = randompromptlist[1] - # make the filename, from from a to the first comma - # find the index of the first comma after "of a" or end of the prompt - if(randomprompt.find("of a ") != -1): - start_index = randomprompt.find("of a ") + len("of a ") - end_index = randomprompt.find(",", start_index) - if(end_index == -1): - end_index=len(randomprompt) - else: - start_index = 0 - end_index = 128 - + if(autonegativeprompt): + negativeprompt = build_dynamic_negative(positive_prompt=randomprompt, insanitylevel=autonegativepromptstrength,enhance=autonegativepromptenhance, existing_negative_prompt=originalnegativeprompt) + if(randomsubject == ""): + # make the filename, from from a to the first comma + # find the index of the first comma after "of a" or end of the prompt + if(randomprompt.find("of a ") != -1): + start_index = randomprompt.find("of a ") + len("of a ") + end_index = randomprompt.find(",", start_index) + if(end_index == -1): + end_index=len(randomprompt) + else: + start_index = 0 + end_index = 128 + + - # extract the desired substring using slicing - filename = randomprompt[start_index:end_index] + # extract the desired substring using slicing + filename = randomprompt[start_index:end_index] + else: + filename = randomsubject # cleanup some unsafe things in the filename filename = filename.replace("\"", "") diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index c47ecad..fa03fec 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -317,7 +317,6 @@ class Script(scripts.Script): with gr.Column(variant="compact"): prefixprompt = gr.Textbox(label="⬅️💬 Place this in front of generated prompt (prefix)",value="") suffixprompt = gr.Textbox(label="➡️💬 Place this at back of generated prompt (suffix)",value="") - negativeprompt = gr.Textbox(label="🚫💬 Use this negative prompt",value="") with gr.Row(variant="compact"): gr.Markdown(""" @@ -652,6 +651,28 @@ class Script(scripts.Script): """ ) + with gr.Tab("Negative prompt"): + gr.Markdown( + """ + ### Negative prompt settings + + """ + ) + with gr.Column(variant="compact"): + with gr.Row(variant="compact"): + autonegativeprompt = gr.Checkbox(label="🤖🚫💬 Auto generate negative prompt", value=True) + autonegativepromptenhance = gr.Checkbox(label="📈🚫💬 Enable base enhancement prompt", value=False) + with gr.Row(variant="compact"): + autonegativepromptstrength = gr.Slider(0, 10, value="0", step=1, label="🎲🚫💬 Randomness of negative prompt (lower is more consistency)") + gr.Markdown( + """ + ### Base negative prompt is added on + + """ + ) + with gr.Row(): + negativeprompt = gr.Textbox(label="🚫💬 Base negative prompt",value="") + with gr.Tab("One Button Run and Upscale"): with gr.Row(variant="compact"): gr.Markdown( @@ -835,7 +856,7 @@ class Script(scripts.Script): prompt4toworkflow.click(prompttoworkflowprompt, inputs=prompt4, outputs=workprompt) prompt5toworkflow.click(prompttoworkflowprompt, inputs=prompt5, outputs=workprompt) - startmain.click(generateimages, inputs=[amountofimages,size,model,samplingsteps,cfg,hiresfix,hiressteps,denoisestrength,samplingmethod, upscaler,hiresscale, apiurl, qualitygate, quality, runs,insanitylevel,subject, artist, imagetype, silentmode, workprompt, antistring, prefixprompt, suffixprompt,negativeprompt,promptcompounderlevel, seperator, img2imgbatch, img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel,img2imgactivate, img2imgscale, img2imgpadding,img2imgdenoisestrength,ultimatesdupscale,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur, controlnetenabled, controlnetmodel,img2imgdenoisestrengthmod,enableextraupscale,controlnetblockymode,extrasupscaler1,extrasupscaler2,extrasupscaler2visiblity,extrasupscaler2gfpgan,extrasupscaler2codeformer,extrasupscaler2codeformerweight,extrasresize,onlyupscale,givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, increasestability, qualityhiresfix, qualitymode, qualitykeep, basesize, promptvariantinsanitylevel, givenoutfit]) + startmain.click(generateimages, inputs=[amountofimages,size,model,samplingsteps,cfg,hiresfix,hiressteps,denoisestrength,samplingmethod, upscaler,hiresscale, apiurl, qualitygate, quality, runs,insanitylevel,subject, artist, imagetype, silentmode, workprompt, antistring, prefixprompt, suffixprompt,negativeprompt,promptcompounderlevel, seperator, img2imgbatch, img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel,img2imgactivate, img2imgscale, img2imgpadding,img2imgdenoisestrength,ultimatesdupscale,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur, controlnetenabled, controlnetmodel,img2imgdenoisestrengthmod,enableextraupscale,controlnetblockymode,extrasupscaler1,extrasupscaler2,extrasupscaler2visiblity,extrasupscaler2gfpgan,extrasupscaler2codeformer,extrasupscaler2codeformerweight,extrasresize,onlyupscale,givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, increasestability, qualityhiresfix, qualitymode, qualitykeep, basesize, promptvariantinsanitylevel, givenoutfit, autonegativeprompt, autonegativepromptstrength, autonegativepromptenhance]) interrupt.click(tryinterrupt, inputs=[apiurl]) automatedoutputsfolderbutton.click(openfolder) @@ -998,12 +1019,12 @@ class Script(scripts.Script): - return [insanitylevel,subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring, seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, promptvariantinsanitylevel, givenoutfit] + return [insanitylevel,subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring, seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, promptvariantinsanitylevel, givenoutfit, autonegativeprompt, autonegativepromptstrength, autonegativepromptenhance] - def run(self, p, insanitylevel, subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring,seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, promptvariantinsanitylevel, givenoutfit): + def run(self, p, insanitylevel, subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring,seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, promptvariantinsanitylevel, givenoutfit, autonegativeprompt, autonegativepromptstrength, autonegativepromptenhance): images = [] infotexts = [] @@ -1097,6 +1118,10 @@ class Script(scripts.Script): print(" ") print(p.prompt) + if(autonegativeprompt): + p.negative_prompt = build_dynamic_negative(positive_prompt=p.prompt, insanitylevel=autonegativepromptstrength,enhance=autonegativepromptenhance, existing_negative_prompt=p.negative_prompt) + + promptlist = [] if(batchsize>1): # finally figured out how to do multiple batch sizes From 8d6747b64b15121ba08027b05ee7e2771165d958 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Mon, 1 Jan 2024 15:52:31 +0100 Subject: [PATCH 06/10] overrides added in some final improvements --- OneButtonPromptNodes.py | 5 +++-- csv_reader.py | 26 ++++++++++++++++++++++++ negativeprompttester.py | 2 +- userfiles/negativewords_addon_sample.csv | 2 ++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 userfiles/negativewords_addon_sample.csv diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index c573e53..d24701a 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -454,7 +454,7 @@ class AutoNegativePrompt: "default": "text, watermark" }), "enhancenegative": ("INT", { - "default": 1, + "default": 0, "min": 0, #Minimum value "max": 1, #Maximum value "step": 1, #Slider's step @@ -501,5 +501,6 @@ NODE_CLASS_MAPPINGS = { NODE_DISPLAY_NAME_MAPPINGS = { "OneButtonPrompt": "One Button Prompt", "CreatePromptVariant": "Create Prompt Variant", - "SavePromptToFile": "Save Prompt To File" + "SavePromptToFile": "Save Prompt To File", + "AutoNegativePrompt": "Auto Negative Prompt", } diff --git a/csv_reader.py b/csv_reader.py index 5438880..47c422a 100644 --- a/csv_reader.py +++ b/csv_reader.py @@ -162,11 +162,24 @@ def load_config_csv(): def load_negative_list(): primerlist = [] negativelist = [] + primeraddonlist = [] + negativeaddonlist = [] + script_dir = os.path.dirname(os.path.abspath(__file__)) full_path_default_negative_file = os.path.join(script_dir, "./csvfiles/special_lists/" ) negative_file = full_path_default_negative_file + 'negativewords.csv' + full_path_replace_negative_file = os.path.join(script_dir, "./userfiles/" ) + replace_negative_file = full_path_replace_negative_file + 'negativewords_replace.csv' + + full_path_addon_negative_file = os.path.join(script_dir, "./userfiles/" ) + addon_negative_file = full_path_addon_negative_file + 'negativewords_addon.csv' + + + if(os.path.isfile(replace_negative_file)): + negative_file = replace_negative_file + with open(negative_file, "r", newline="",encoding="utf8") as file: reader = csv.DictReader(file, delimiter=";") primerlist = [row["primer"] for row in reader] @@ -174,6 +187,19 @@ def load_negative_list(): reader = csv.DictReader(file, delimiter=";") negativelist = [row["negative"] for row in reader] + + if(os.path.isfile(addon_negative_file)): + with open(addon_negative_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=";") + primeraddonlist = [row["primer"] for row in reader] + with open(addon_negative_file, "r", newline="",encoding="utf8") as file: + reader = csv.DictReader(file, delimiter=";") + negativeaddonlist = [row["negative"] for row in reader] + + primerlist += primeraddonlist + negativelist += negativeaddonlist + + return primerlist, negativelist def load_all_artist_and_category(): diff --git a/negativeprompttester.py b/negativeprompttester.py index 75e31b2..e976f6f 100644 --- a/negativeprompttester.py +++ b/negativeprompttester.py @@ -32,4 +32,4 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=Fa print("") print("All done!") -generateprompts(1,"",1,False,"") \ No newline at end of file +generateprompts(1,"anime assassin",0,False,"") \ No newline at end of file diff --git a/userfiles/negativewords_addon_sample.csv b/userfiles/negativewords_addon_sample.csv new file mode 100644 index 0000000..80edf0a --- /dev/null +++ b/userfiles/negativewords_addon_sample.csv @@ -0,0 +1,2 @@ +primer;negative +assassin;assassins creed \ No newline at end of file From 04f4df54a03df34f241c90ebb9ab859bbc32527e Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Mon, 1 Jan 2024 16:08:33 +0100 Subject: [PATCH 07/10] Update comfyui_integration.md --- user_guides/comfyui_integration.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/user_guides/comfyui_integration.md b/user_guides/comfyui_integration.md index fb97538..a68564e 100644 --- a/user_guides/comfyui_integration.md +++ b/user_guides/comfyui_integration.md @@ -1,10 +1,11 @@ # ComfyUI integration One Button Prompt is now also a ComfyUI extension. -There are 3 nodes currently availabe, with One Button Prompt node being the main one. +There are 4 nodes currently availabe, with One Button Prompt node being the main one. You can slam it in every workflow, where you replace it with the Positive Prompt node. -![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/bc7231b5-345c-4069-862d-2afdf733a526) +![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/342bd715-9b7e-4e1a-a3ba-ff3b557b89cc) + ## Installing in ComfyUI One Button Prompt is available in ComfyUI manager. @@ -78,7 +79,18 @@ You can also use other extension for this. But I thought it was nice to include Just simply also connect the output of One Button Prompt to the Postive Prompt node. -![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/1557546d-36f3-4ce0-9532-cf5a8386297d) +![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/edaf7cec-7e95-46a9-84dc-00da4aaf2c4e) + +### Auto Negative Prompt + +The Auto Negative Prompt node, generates a negative prompt, based on the positive input. It can be used stand-alone as well, with any prompt field. It will try to enhance what was in the positive prompt. For example "anime" in the positive prompt, will add "photorealistic" in the negative prompt. + +The following options are available: + +base_negative --> Will be added onto the negative prompt +enhancenegative --> Will push a lot of quality enhancing terms into the negative prompt. Default value = 0 +insanitylevel --> Larger numbers will randomly lower the amount of things in the negative prompt. Default value = 0 + ### Known issues From ba66124cc8e7f850847f7354c42260454c806572 Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Mon, 1 Jan 2024 16:08:57 +0100 Subject: [PATCH 08/10] Update comfyui_integration.md --- user_guides/comfyui_integration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guides/comfyui_integration.md b/user_guides/comfyui_integration.md index a68564e..9820633 100644 --- a/user_guides/comfyui_integration.md +++ b/user_guides/comfyui_integration.md @@ -88,7 +88,9 @@ The Auto Negative Prompt node, generates a negative prompt, based on the positiv The following options are available: base_negative --> Will be added onto the negative prompt + enhancenegative --> Will push a lot of quality enhancing terms into the negative prompt. Default value = 0 + insanitylevel --> Larger numbers will randomly lower the amount of things in the negative prompt. Default value = 0 From b740957340356f531e7e847669bd73f44d92d9cb Mon Sep 17 00:00:00 2001 From: AIrjen Date: Mon, 1 Jan 2024 16:10:29 +0100 Subject: [PATCH 09/10] Updated default workflows --- .../SDXL_OBP_Refiner.json | 889 +++++++++--------- .../SDX_OBP_NoRefiner.json | 791 ++++++++-------- 2 files changed, 821 insertions(+), 859 deletions(-) diff --git a/comfyui_workflow_examples/SDXL_OBP_Refiner.json b/comfyui_workflow_examples/SDXL_OBP_Refiner.json index 753bfd4..4168f00 100644 --- a/comfyui_workflow_examples/SDXL_OBP_Refiner.json +++ b/comfyui_workflow_examples/SDXL_OBP_Refiner.json @@ -1,6 +1,6 @@ { - "last_node_id": 221, - "last_link_id": 319, + "last_node_id": 225, + "last_link_id": 333, "nodes": [ { "id": 39, @@ -50,7 +50,7 @@ 26 ], "flags": {}, - "order": 24, + "order": 26, "mode": 0, "inputs": [ { @@ -86,7 +86,7 @@ 26 ], "flags": {}, - "order": 22, + "order": 18, "mode": 0, "inputs": [ { @@ -196,7 +196,7 @@ "flags": { "collapsed": false }, - "order": 17, + "order": 23, "mode": 0, "inputs": [ { @@ -207,31 +207,17 @@ { "name": "text_g", "type": "STRING", - "link": 139, + "link": 331, "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] + "name": "text_g" } }, { "name": "text_l", "type": "STRING", - "link": 308, + "link": 332, "widget": { - "name": "text_l", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_L" - } - ] + "name": "text_l" }, "slot_index": 2 } @@ -276,7 +262,7 @@ "flags": { "collapsed": false }, - "order": 18, + "order": 19, "mode": 0, "inputs": [ { @@ -287,32 +273,18 @@ { "name": "text_g", "type": "STRING", - "link": 305, + "link": 323, "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] + "name": "text_g" }, "slot_index": 1 }, { "name": "text_l", "type": "STRING", - "link": 306, + "link": 324, "widget": { - "name": "text_l", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_L" - } - ] + "name": "text_l" }, "slot_index": 2 } @@ -355,7 +327,7 @@ "1": 316.8831481933594 }, "flags": {}, - "order": 23, + "order": 25, "mode": 0, "inputs": [ { @@ -383,15 +355,7 @@ "type": "INT", "link": 225, "widget": { - "name": "steps", - "config": [ - "INT", - { - "default": 20, - "min": 1, - "max": 10000 - } - ] + "name": "steps" } }, { @@ -399,15 +363,7 @@ "type": "INT", "link": 228, "widget": { - "name": "end_at_step", - "config": [ - "INT", - { - "default": 10000, - "min": 0, - "max": 10000 - } - ] + "name": "end_at_step" } }, { @@ -415,15 +371,7 @@ "type": "INT", "link": 235, "widget": { - "name": "noise_seed", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] + "name": "noise_seed" }, "slot_index": 6 }, @@ -432,15 +380,7 @@ "type": "FLOAT", "link": 237, "widget": { - "name": "cfg", - "config": [ - "FLOAT", - { - "default": 8, - "min": 0, - "max": 100 - } - ] + "name": "cfg" }, "slot_index": 7 } @@ -497,15 +437,7 @@ 237 ], "widget": { - "name": "cfg", - "config": [ - "FLOAT", - { - "default": 8, - "min": 0, - "max": 100 - } - ] + "name": "cfg" } } ], @@ -530,7 +462,7 @@ "1": 152.06405639648438 }, "flags": {}, - "order": 21, + "order": 24, "mode": 0, "inputs": [ { @@ -541,15 +473,9 @@ { "name": "text", "type": "STRING", - "link": 309, + "link": 333, "widget": { - "name": "text", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "text" }, "slot_index": 1 } @@ -657,7 +583,7 @@ "1": 317.9724426269531 }, "flags": {}, - "order": 25, + "order": 27, "mode": 0, "inputs": [ { @@ -685,15 +611,7 @@ "type": "INT", "link": 226, "widget": { - "name": "steps", - "config": [ - "INT", - { - "default": 20, - "min": 1, - "max": 10000 - } - ] + "name": "steps" } }, { @@ -701,15 +619,7 @@ "type": "INT", "link": 229, "widget": { - "name": "start_at_step", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 10000 - } - ] + "name": "start_at_step" } }, { @@ -717,15 +627,7 @@ "type": "INT", "link": 236, "widget": { - "name": "noise_seed", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] + "name": "noise_seed" } } ], @@ -783,15 +685,7 @@ ], "slot_index": 0, "widget": { - "name": "steps", - "config": [ - "INT", - { - "default": 20, - "min": 1, - "max": 10000 - } - ] + "name": "steps" } } ], @@ -828,15 +722,7 @@ ], "slot_index": 0, "widget": { - "name": "end_at_step", - "config": [ - "INT", - { - "default": 10000, - "min": 0, - "max": 10000 - } - ] + "name": "end_at_step" } } ], @@ -872,15 +758,7 @@ 236 ], "widget": { - "name": "noise_seed", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] + "name": "noise_seed" }, "slot_index": 0 } @@ -888,7 +766,7 @@ "title": "Seed", "properties": {}, "widgets_values": [ - 982453438627869, + 186488958305883, "randomize" ], "color": "#432", @@ -917,15 +795,9 @@ { "name": "text", "type": "STRING", - "link": 307, + "link": 325, "widget": { - "name": "text", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "text" }, "slot_index": 1 } @@ -964,7 +836,7 @@ "1": 102.28533172607422 }, "flags": {}, - "order": 26, + "order": 28, "mode": 0, "inputs": [ { @@ -994,50 +866,6 @@ "Node name for S&R": "VAEDecode" } }, - { - "id": 215, - "type": "PrimitiveNode", - "pos": [ - -1081, - -244 - ], - "size": { - "0": 210, - "1": 58 - }, - "flags": { - "collapsed": false - }, - "order": 7, - "mode": 0, - "outputs": [ - { - "name": "STRING", - "type": "STRING", - "links": [ - 311 - ], - "slot_index": 0, - "widget": { - "name": "custom_subject", - "config": [ - "STRING", - { - "multiline": false, - "default": "" - } - ] - } - } - ], - "title": "Overwrite Subject", - "properties": {}, - "widgets_values": [ - "" - ], - "color": "#232", - "bgcolor": "#353" - }, { "id": 200, "type": "Note", @@ -1050,7 +878,7 @@ "1": 210 }, "flags": {}, - "order": 8, + "order": 6, "mode": 0, "title": "Note - Empty Latent Image", "properties": { @@ -1069,12 +897,12 @@ 404, 202 ], - "size": [ - 565.774658203125, - 596.3757934570312 - ], + "size": { + "0": 565.774658203125, + "1": 596.3757934570312 + }, "flags": {}, - "order": 27, + "order": 29, "mode": 0, "inputs": [ { @@ -1087,13 +915,7 @@ "type": "STRING", "link": 319, "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "ComfyUI" - } - ] + "name": "filename_prefix" } } ], @@ -1118,7 +940,7 @@ "flags": { "collapsed": false }, - "order": 10, + "order": 7, "mode": 0, "outputs": [ { @@ -1171,7 +993,7 @@ "1": 101.19705200195312 }, "flags": {}, - "order": 11, + "order": 8, "mode": 0, "outputs": [ { @@ -1208,140 +1030,6 @@ "color": "#432", "bgcolor": "#653" }, - { - "id": 213, - "type": "OneButtonPrompt", - "pos": [ - -778, - -250 - ], - "size": { - "0": 315, - "1": 322 - }, - "flags": {}, - "order": 13, - "mode": 0, - "inputs": [ - { - "name": "custom_subject", - "type": "STRING", - "link": 311, - "widget": { - "name": "custom_subject", - "config": [ - "STRING", - { - "multiline": false, - "default": "" - } - ] - } - } - ], - "outputs": [ - { - "name": "prompt", - "type": "STRING", - "links": [ - 305, - 306, - 307, - 316 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "OneButtonPrompt" - }, - "widgets_values": [ - 5, - "all", - "all", - 20, - "all", - "", - "all", - "all", - "all", - "all", - false, - 547016836023746, - "randomize" - ], - "color": "#2a363b", - "bgcolor": "#3f5159" - }, - { - "id": 221, - "type": "Note", - "pos": [ - -1097, - -380 - ], - "size": { - "0": 210, - "1": 58 - }, - "flags": {}, - "order": 12, - "mode": 0, - "properties": { - "text": "" - }, - "widgets_values": [ - "Originally made by blitzk241\nThank you!" - ], - "color": "#432", - "bgcolor": "#653" - }, - { - "id": 16, - "type": "PrimitiveNode", - "pos": [ - -1318, - -101 - ], - "size": { - "0": 434.15277099609375, - "1": 152.36099243164062 - }, - "flags": {}, - "order": 6, - "mode": 0, - "outputs": [ - { - "name": "STRING", - "type": "STRING", - "links": [ - 139, - 308, - 309, - 317 - ], - "slot_index": 0, - "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] - } - } - ], - "title": "Negative Prompt", - "properties": {}, - "widgets_values": [ - "text, watermark" - ], - "color": "#322", - "bgcolor": "#533" - }, { "id": 220, "type": "PrimitiveNode", @@ -1365,13 +1053,7 @@ 319 ], "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "Prompt" - } - ] + "name": "filename_prefix" }, "slot_index": 0 } @@ -1391,12 +1073,12 @@ 164, -219 ], - "size": [ - 216.3093705610795, - 94.55757002397013 - ], + "size": { + "0": 216.3093719482422, + "1": 166 + }, "flags": {}, - "order": 19, + "order": 22, "mode": 0, "inputs": [ { @@ -1404,42 +1086,24 @@ "type": "STRING", "link": 318, "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "Prompt" - } - ] + "name": "filename_prefix" }, "slot_index": 0 }, { "name": "positive_prompt", "type": "STRING", - "link": 316, + "link": 320, "widget": { - "name": "positive_prompt", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "positive_prompt" } }, { "name": "negative_prompt", "type": "STRING", - "link": 317, + "link": 330, "widget": { - "name": "negative_prompt", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "negative_prompt" } } ], @@ -1449,10 +1113,285 @@ "widgets_values": [ "%date:yyyy-M-d%/ComfyUI", "", - "text, watermark" + "text, watermark", + "", + "" ], "color": "#2a363b", "bgcolor": "#3f5159" + }, + { + "id": 221, + "type": "Note", + "pos": [ + -1129, + -566 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": {}, + "order": 10, + "mode": 0, + "properties": { + "text": "" + }, + "widgets_values": [ + "Originally made by blitzk241\nThank you!" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 215, + "type": "PrimitiveNode", + "pos": [ + -1131, + -461 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": false + }, + "order": 11, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 326 + ], + "slot_index": 0, + "widget": { + "name": "custom_subject" + } + } + ], + "title": "Overwrite Subject", + "properties": {}, + "widgets_values": [ + "" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 223, + "type": "PrimitiveNode", + "pos": [ + -1137, + -351 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": false + }, + "order": 12, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 327 + ], + "slot_index": 0, + "widget": { + "name": "custom_outfit" + } + } + ], + "title": "Overwrite Outfit", + "properties": {}, + "widgets_values": [ + "" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 16, + "type": "PrimitiveNode", + "pos": [ + -1333, + -97 + ], + "size": { + "0": 434.15277099609375, + "1": 152.36099243164062 + }, + "flags": {}, + "order": 13, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 328 + ], + "slot_index": 0, + "widget": { + "name": "text_g" + } + } + ], + "title": "Negative Prompt", + "properties": {}, + "widgets_values": [ + "text, watermark" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 222, + "type": "OneButtonPrompt", + "pos": [ + -785, + -470 + ], + "size": { + "0": 315, + "1": 370 + }, + "flags": {}, + "order": 17, + "mode": 0, + "inputs": [ + { + "name": "custom_subject", + "type": "STRING", + "link": 326, + "widget": { + "name": "custom_subject" + } + }, + { + "name": "custom_outfit", + "type": "STRING", + "link": 327, + "widget": { + "name": "custom_outfit" + } + } + ], + "outputs": [ + { + "name": "prompt", + "type": "STRING", + "links": [ + 320, + 323, + 324, + 325, + 329 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "prompt_g", + "type": "STRING", + "links": null, + "shape": 3 + }, + { + "name": "prompt_l", + "type": "STRING", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "OneButtonPrompt" + }, + "widgets_values": [ + 5, + "all", + "all", + 20, + "all", + "", + "", + "all", + "all", + "all", + "all", + false, + 0, + "randomize" + ], + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 225, + "type": "AutoNegativePrompt", + "pos": [ + -794, + -55 + ], + "size": [ + 319.0404052734375, + 162 + ], + "flags": {}, + "order": 21, + "mode": 0, + "inputs": [ + { + "name": "postive_prompt", + "type": "STRING", + "link": 329, + "widget": { + "name": "postive_prompt" + } + }, + { + "name": "base_negative", + "type": "STRING", + "link": 328, + "widget": { + "name": "base_negative" + } + } + ], + "outputs": [ + { + "name": "negative_prompt", + "type": "STRING", + "links": [ + 330, + 331, + 332, + 333 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "AutoNegativePrompt" + }, + "widgets_values": [ + "", + "text, watermark", + 0, + 0, + 0, + "randomize" + ], + "color": "#322", + "bgcolor": "#533" } ], "links": [ @@ -1504,14 +1443,6 @@ 0, "*" ], - [ - 139, - 16, - 0, - 65, - 1, - "STRING" - ], [ 199, 50, @@ -1680,70 +1611,6 @@ 1, "VAE" ], - [ - 305, - 213, - 0, - 50, - 1, - "STRING" - ], - [ - 306, - 213, - 0, - 50, - 2, - "STRING" - ], - [ - 307, - 213, - 0, - 70, - 1, - "STRING" - ], - [ - 308, - 16, - 0, - 65, - 2, - "STRING" - ], - [ - 309, - 16, - 0, - 71, - 1, - "STRING" - ], - [ - 311, - 215, - 0, - 213, - 0, - "STRING" - ], - [ - 316, - 213, - 0, - 219, - 1, - "STRING" - ], - [ - 317, - 16, - 0, - 219, - 2, - "STRING" - ], [ 318, 220, @@ -1759,6 +1626,102 @@ 199, 1, "STRING" + ], + [ + 320, + 222, + 0, + 219, + 1, + "STRING" + ], + [ + 323, + 222, + 0, + 50, + 1, + "STRING" + ], + [ + 324, + 222, + 0, + 50, + 2, + "STRING" + ], + [ + 325, + 222, + 0, + 70, + 1, + "STRING" + ], + [ + 326, + 215, + 0, + 222, + 0, + "STRING" + ], + [ + 327, + 223, + 0, + 222, + 1, + "STRING" + ], + [ + 328, + 16, + 0, + 225, + 1, + "STRING" + ], + [ + 329, + 222, + 0, + 225, + 0, + "STRING" + ], + [ + 330, + 225, + 0, + 219, + 2, + "STRING" + ], + [ + 331, + 225, + 0, + 65, + 1, + "STRING" + ], + [ + 332, + 225, + 0, + 65, + 2, + "STRING" + ], + [ + 333, + 225, + 0, + 71, + 1, + "STRING" ] ], "groups": [], diff --git a/comfyui_workflow_examples/SDX_OBP_NoRefiner.json b/comfyui_workflow_examples/SDX_OBP_NoRefiner.json index 5633fe3..656bab6 100644 --- a/comfyui_workflow_examples/SDX_OBP_NoRefiner.json +++ b/comfyui_workflow_examples/SDX_OBP_NoRefiner.json @@ -1,6 +1,6 @@ { - "last_node_id": 220, - "last_link_id": 323, + "last_node_id": 223, + "last_link_id": 333, "nodes": [ { "id": 160, @@ -24,15 +24,7 @@ 237 ], "widget": { - "name": "cfg", - "config": [ - "FLOAT", - { - "default": 8, - "min": 0, - "max": 100 - } - ] + "name": "cfg" } } ], @@ -105,15 +97,7 @@ ], "slot_index": 0, "widget": { - "name": "steps", - "config": [ - "INT", - { - "default": 20, - "min": 1, - "max": 10000 - } - ] + "name": "steps" } } ], @@ -148,15 +132,7 @@ 235 ], "widget": { - "name": "noise_seed", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] + "name": "noise_seed" }, "slot_index": 0 } @@ -164,7 +140,7 @@ "title": "Seed", "properties": {}, "widgets_values": [ - 1111747466290750, + 604260618514801, "randomize" ], "color": "#432", @@ -195,32 +171,18 @@ { "name": "text_g", "type": "STRING", - "link": 305, + "link": 325, "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] + "name": "text_g" }, "slot_index": 1 }, { "name": "text_l", "type": "STRING", - "link": 306, + "link": 326, "widget": { - "name": "text_l", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_L" - } - ] + "name": "text_l" }, "slot_index": 2 } @@ -263,7 +225,7 @@ "1": 316.8831481933594 }, "flags": {}, - "order": 15, + "order": 17, "mode": 0, "inputs": [ { @@ -291,15 +253,7 @@ "type": "INT", "link": 225, "widget": { - "name": "steps", - "config": [ - "INT", - { - "default": 20, - "min": 1, - "max": 10000 - } - ] + "name": "steps" } }, { @@ -307,15 +261,7 @@ "type": "INT", "link": 228, "widget": { - "name": "end_at_step", - "config": [ - "INT", - { - "default": 10000, - "min": 0, - "max": 10000 - } - ] + "name": "end_at_step" } }, { @@ -323,15 +269,7 @@ "type": "INT", "link": 235, "widget": { - "name": "noise_seed", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] + "name": "noise_seed" }, "slot_index": 6 }, @@ -340,15 +278,7 @@ "type": "FLOAT", "link": 237, "widget": { - "name": "cfg", - "config": [ - "FLOAT", - { - "default": 8, - "min": 0, - "max": 100 - } - ] + "name": "cfg" }, "slot_index": 7 } @@ -406,15 +336,7 @@ ], "slot_index": 0, "widget": { - "name": "end_at_step", - "config": [ - "INT", - { - "default": 10000, - "min": 0, - "max": 10000 - } - ] + "name": "end_at_step" } } ], @@ -439,7 +361,7 @@ 26 ], "flags": {}, - "order": 16, + "order": 18, "mode": 0, "inputs": [ { @@ -475,7 +397,7 @@ "1": 102.28533172607422 }, "flags": {}, - "order": 17, + "order": 19, "mode": 0, "inputs": [ { @@ -512,12 +434,12 @@ 393, 148 ], - "size": [ - 565.774658203125, - 596.3757934570312 - ], + "size": { + "0": 565.774658203125, + "1": 596.3757934570312 + }, "flags": {}, - "order": 18, + "order": 20, "mode": 0, "inputs": [ { @@ -530,13 +452,7 @@ "type": "STRING", "link": 323, "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "ComfyUI" - } - ] + "name": "filename_prefix" } } ], @@ -554,40 +470,28 @@ -83, -88 ], - "size": [ - 210, - 84.49069064331059 - ], + "size": { + "0": 210, + "1": 166 + }, "flags": {}, - "order": 14, + "order": 15, "mode": 0, "inputs": [ { "name": "positive_prompt", "type": "STRING", - "link": 320, + "link": 324, "widget": { - "name": "positive_prompt", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "positive_prompt" } }, { "name": "negative_prompt", "type": "STRING", - "link": 321, + "link": 330, "widget": { - "name": "negative_prompt", - "config": [ - "STRING", - { - "multiline": true - } - ] + "name": "negative_prompt" } }, { @@ -595,13 +499,7 @@ "type": "STRING", "link": 322, "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "Prompt" - } - ] + "name": "filename_prefix" }, "slot_index": 2 } @@ -612,7 +510,9 @@ "widgets_values": [ "%date:yyyy-M-d%/ComfyUI", "", - "text, watermark\n" + "text, watermark\n", + "", + "" ], "color": "#2a363b", "bgcolor": "#3f5159" @@ -690,13 +590,7 @@ 323 ], "widget": { - "name": "filename_prefix", - "config": [ - "STRING", - { - "default": "Prompt" - } - ] + "name": "filename_prefix" }, "slot_index": 0 } @@ -709,115 +603,6 @@ "color": "#2a363b", "bgcolor": "#3f5159" }, - { - "id": 213, - "type": "OneButtonPrompt", - "pos": [ - -746, - -306 - ], - "size": { - "0": 315, - "1": 322 - }, - "flags": {}, - "order": 11, - "mode": 0, - "inputs": [ - { - "name": "custom_subject", - "type": "STRING", - "link": 311, - "widget": { - "name": "custom_subject", - "config": [ - "STRING", - { - "multiline": false, - "default": "" - } - ] - } - } - ], - "outputs": [ - { - "name": "prompt", - "type": "STRING", - "links": [ - 305, - 306, - 320 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "OneButtonPrompt" - }, - "widgets_values": [ - 5, - "all", - "all", - 20, - "all", - "", - "all", - "all", - "all", - "all", - false, - 727091149492509, - "randomize" - ], - "color": "#2a363b", - "bgcolor": "#3f5159" - }, - { - "id": 215, - "type": "PrimitiveNode", - "pos": [ - -1027, - -303 - ], - "size": { - "0": 210, - "1": 58 - }, - "flags": { - "collapsed": false - }, - "order": 7, - "mode": 0, - "outputs": [ - { - "name": "STRING", - "type": "STRING", - "links": [ - 311 - ], - "slot_index": 0, - "widget": { - "name": "custom_subject", - "config": [ - "STRING", - { - "multiline": false, - "default": "" - } - ] - } - } - ], - "title": "Overwrite Subject", - "properties": {}, - "widgets_values": [ - "" - ], - "color": "#232", - "bgcolor": "#353" - }, { "id": 200, "type": "Note", @@ -830,7 +615,7 @@ "1": 210 }, "flags": {}, - "order": 8, + "order": 7, "mode": 0, "title": "Note - Empty Latent Image", "properties": { @@ -842,73 +627,6 @@ "color": "#323", "bgcolor": "#535" }, - { - "id": 220, - "type": "Note", - "pos": [ - -1021, - -420 - ], - "size": { - "0": 210, - "1": 58 - }, - "flags": {}, - "order": 9, - "mode": 0, - "properties": { - "text": "" - }, - "widgets_values": [ - "Made by blitzk241\nThank you!" - ], - "color": "#432", - "bgcolor": "#653" - }, - { - "id": 16, - "type": "PrimitiveNode", - "pos": [ - -1259, - -176 - ], - "size": { - "0": 434.15277099609375, - "1": 152.36099243164062 - }, - "flags": {}, - "order": 10, - "mode": 0, - "outputs": [ - { - "name": "STRING", - "type": "STRING", - "links": [ - 139, - 308, - 321 - ], - "slot_index": 0, - "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] - } - } - ], - "title": "Negative Prompt", - "properties": {}, - "widgets_values": [ - "text, watermark\n" - ], - "color": "#322", - "bgcolor": "#533" - }, { "id": 65, "type": "CLIPTextEncodeSDXL", @@ -923,7 +641,7 @@ "flags": { "collapsed": false }, - "order": 12, + "order": 16, "mode": 0, "inputs": [ { @@ -934,31 +652,17 @@ { "name": "text_g", "type": "STRING", - "link": 139, + "link": 331, "widget": { - "name": "text_g", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_G" - } - ] + "name": "text_g" } }, { "name": "text_l", "type": "STRING", - "link": 308, + "link": 332, "widget": { - "name": "text_l", - "config": [ - "STRING", - { - "multiline": true, - "default": "CLIP_L" - } - ] + "name": "text_l" }, "slot_index": 2 } @@ -988,17 +692,280 @@ "text, watermark\n", "text, watermark\n" ] + }, + { + "id": 220, + "type": "Note", + "pos": [ + -1027, + -640 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": {}, + "order": 8, + "mode": 0, + "properties": { + "text": "" + }, + "widgets_values": [ + "Made by blitzk241\nThank you!" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 215, + "type": "PrimitiveNode", + "pos": [ + -1025, + -539 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": false + }, + "order": 9, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 327 + ], + "slot_index": 0, + "widget": { + "name": "custom_subject" + } + } + ], + "title": "Overwrite Subject", + "properties": {}, + "widgets_values": [ + "" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 222, + "type": "PrimitiveNode", + "pos": [ + -1032, + -433 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": false + }, + "order": 10, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 328 + ], + "slot_index": 0, + "widget": { + "name": "custom_outfit" + } + } + ], + "title": "Overwrite Outfit", + "properties": {}, + "widgets_values": [ + "" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 223, + "type": "AutoNegativePrompt", + "pos": [ + -633, + -113 + ], + "size": [ + 327, + 170.40017700195312 + ], + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [ + { + "name": "postive_prompt", + "type": "STRING", + "link": 333, + "widget": { + "name": "postive_prompt" + } + }, + { + "name": "base_negative", + "type": "STRING", + "link": 329, + "widget": { + "name": "base_negative" + } + } + ], + "outputs": [ + { + "name": "negative_prompt", + "type": "STRING", + "links": [ + 330, + 331, + 332 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "AutoNegativePrompt" + }, + "widgets_values": [ + "", + "text, watermark\n", + 0, + 0, + 0, + "randomize" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 221, + "type": "OneButtonPrompt", + "pos": [ + -630, + -538 + ], + "size": { + "0": 315, + "1": 370 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "custom_subject", + "type": "STRING", + "link": 327, + "widget": { + "name": "custom_subject" + } + }, + { + "name": "custom_outfit", + "type": "STRING", + "link": 328, + "widget": { + "name": "custom_outfit" + } + } + ], + "outputs": [ + { + "name": "prompt", + "type": "STRING", + "links": [ + 324, + 325, + 326, + 333 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "prompt_g", + "type": "STRING", + "links": null, + "shape": 3 + }, + { + "name": "prompt_l", + "type": "STRING", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "OneButtonPrompt" + }, + "widgets_values": [ + 5, + "all", + "all", + 20, + "all", + "", + "", + "all", + "all", + "all", + "all", + false, + 0, + "randomize" + ], + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 16, + "type": "PrimitiveNode", + "pos": [ + -1242, + -95 + ], + "size": { + "0": 434.15277099609375, + "1": 152.36099243164062 + }, + "flags": {}, + "order": 11, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 329 + ], + "slot_index": 0, + "widget": { + "name": "text_g" + } + } + ], + "title": "Negative Prompt", + "properties": {}, + "widgets_values": [ + "text, watermark\n" + ], + "color": "#322", + "bgcolor": "#533" } ], "links": [ - [ - 139, - 16, - 0, - 65, - 1, - "STRING" - ], [ 199, 50, @@ -1087,38 +1054,6 @@ 0, "IMAGE" ], - [ - 305, - 213, - 0, - 50, - 1, - "STRING" - ], - [ - 306, - 213, - 0, - 50, - 2, - "STRING" - ], - [ - 308, - 16, - 0, - 65, - 2, - "STRING" - ], - [ - 311, - 215, - 0, - 213, - 0, - "STRING" - ], [ 315, 41, @@ -1143,22 +1078,6 @@ 0, "*" ], - [ - 320, - 213, - 0, - 218, - 0, - "STRING" - ], - [ - 321, - 16, - 0, - 218, - 1, - "STRING" - ], [ 322, 219, @@ -1174,6 +1093,86 @@ 199, 1, "STRING" + ], + [ + 324, + 221, + 0, + 218, + 0, + "STRING" + ], + [ + 325, + 221, + 0, + 50, + 1, + "STRING" + ], + [ + 326, + 221, + 0, + 50, + 2, + "STRING" + ], + [ + 327, + 215, + 0, + 221, + 0, + "STRING" + ], + [ + 328, + 222, + 0, + 221, + 1, + "STRING" + ], + [ + 329, + 16, + 0, + 223, + 1, + "STRING" + ], + [ + 330, + 223, + 0, + 218, + 1, + "STRING" + ], + [ + 331, + 223, + 0, + 65, + 1, + "STRING" + ], + [ + 332, + 223, + 0, + 65, + 2, + "STRING" + ], + [ + 333, + 221, + 0, + 223, + 0, + "STRING" ] ], "groups": [], From 752b57c0769dc1f19c889426799335439c9957df Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Mon, 1 Jan 2024 16:29:19 +0100 Subject: [PATCH 10/10] Create auto_negative_prompt.md --- user_guides/auto_negative_prompt.md | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 user_guides/auto_negative_prompt.md diff --git a/user_guides/auto_negative_prompt.md b/user_guides/auto_negative_prompt.md new file mode 100644 index 0000000..37691fa --- /dev/null +++ b/user_guides/auto_negative_prompt.md @@ -0,0 +1,51 @@ +# Auto Negative Prompt + +With the magic of an __Auto Negative Prompt__! Get better results from your prompts. Without any effort. + +Go from this: +Without Negative +To this: +With Auto Negative Prompt + +Go from this: +Without Negative +To this: +With Auto Negative Prompt + +Go from this: +Without Negative +To this: +With Auto Negative Prompt + + + +> colorful art designed by Loish and Krenz Cushart, Anime Graceful broad-shouldered (Woman:1.2), wearing costume, her costume has a crest on chest, royal pose, Auburn hair styled as Slicked-back, equirectangular 360, Fantasy, dreamy, perfect skin +> +> digital art, kawaii Woman of Performance Feudal lord, Bokeh, Alternative Art +> +> Water color painting, elegant, Thundering short Selene, her hair is Pink, Dynamic, dramatic lighting, One Color + +With an __Auto Negative Prompt__! This is now default turned on in A1111. It's also available as a ComfyUI Node. + +Auto Negative Prompt parses your prompt, and tries to invert some words of the prompt. For example, "anime" will add "photorealistic" to the negative prompt. "colorful" will add things like "drab" and "monochrome" to the negative prompt. + +It tries to follow the intent of the positive prompt. + +## Options + +![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/e133386b-c310-4b1c-8e6e-d5c78a000eb4) + +### 🤖🚫💬 Auto generate negative prompt +This turns the generation of the negative prompt on or off. Default, it is turned on. + +### 📈🚫💬 Enable base enhancement prompt +This adds a bunch of quality enhancing statements to the negative prompt. Default, it is turned off. + +### 🎲🚫💬 Randomness of negative prompt +Increasing this value will remove more parts of the negative prompt. A setting of 5 will randomly remove about 50%. Standardly this is turned off, and is at value 0. + +### 🚫💬 Base negative prompt +This is your normal negative prompt. This will get fully added, at the end of the generated negative prompt. + +## ComfyUI example +![image](https://github.com/AIrjen/OneButtonPrompt/assets/130234949/9592ea2a-79d1-4eb3-a21d-ecc20217fd70)