From 70227d992c7664fc210154606ae5dc52e3726b6c Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Sun, 24 Sep 2023 07:57:47 +0200 Subject: [PATCH] prepwork for additional natural language --- build_dynamic_prompt.py | 37 +++++++++++++++++++++----- csv_reader.py | 4 +-- csvfiles/special_lists/buildoutfit.csv | 12 ++++----- prompttester.py | 2 +- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 07bd1d9..5e6957f 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -36,6 +36,13 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # clean up antivalue list: 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"): + genderchoicelist = ["male", "female"] + gender == random.choice(genderchoicelist) + heshelist = ["it"] + hisherlist = ["it's"] + # build all lists here colorlist = csv_to_list("colors",antilist) @@ -962,7 +969,17 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all if(subtypeconcept == "names from card based games"): subjectchooser = "cardname" + # After we chose the subject, lets set all things ready for He/She/It etc + if(subjectchooser in ["human", "job", "fictional", "non fictional", "humanoid", "manwomanrelation","firstname"]): + if(gender == "male"): + heshelist = ["he"] + hisherlist = ["his"] + if(gender == "female"): + heshelist = ["she"] + hisherlist = ["her"] + + # special modes @@ -1584,7 +1601,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # outfit builder if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] and chance_roll(insanitylevel, outfitchance) and generateoutfit == True and humanspecial != 1): - completeprompt += ", wearing " + random.choice(buildoutfitlist) + ", " + completeprompt += ", " + random.choice(buildoutfitlist) + ", " if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid", "manwomanrelation", "firstname"] and chance_roll(insanitylevel, posechance) and humanspecial != 1 and generatepose == True): completeprompt += random.choice(poselist) + ", " @@ -1926,8 +1943,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all - - # completeprompt = parse_custom_functions(completeprompt, insanitylevel) + # In front and the back? + completeprompt = parse_custom_functions(completeprompt, insanitylevel) @@ -2022,9 +2039,11 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all "-animalsuffixaddition-" in completeprompt or "-chair-" in completeprompt or "-cardname-" in completeprompt or - "-covering-" 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-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-artistfantasy-", "-artistpopular-", "-artistromanticism-", "-artistphotography-", "-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-"] - 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, 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] + "-covering-" in completeprompt or + "-heshe-" in completeprompt or + "-hisher-" 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-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-artistfantasy-", "-artistpopular-", "-artistromanticism-", "-artistphotography-", "-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-"] + 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, 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] allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-", "-outfitprinttotal-"] allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist, outfitprinttotallist] @@ -2619,6 +2638,12 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy else: replacementvalue = "" + + # Sneaky overrides for "same" wildcards + # Are overwritten with their first parent + if(wildcard == "-outfit-" or wildcard == "-minioutfit-"): + completeprompt = completeprompt.replace("-sameoutfit-", replacementvalue,1) + completeprompt = completeprompt.replace(wildcard, replacementvalue,1) diff --git a/csv_reader.py b/csv_reader.py index 4066fbf..87d8588 100644 --- a/csv_reader.py +++ b/csv_reader.py @@ -48,7 +48,7 @@ def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip for row in reader: value = row[0] if( - (gender != "all" and row[1] == gender) + gender != "all" and (row[1] == gender or row[1] == "genderless" or row[1] == "both") or gender == "all" ): if(value.lower().strip() not in antilist): @@ -70,7 +70,7 @@ def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip for row in reader: value = row[0] if( - (gender != "all" and row[1] == gender) + gender != "all" and (row[1] == gender or row[1] == "genderless" or row[1] == "both") or gender == "all" ): if(value.lower().strip() not in antilist): diff --git a/csvfiles/special_lists/buildoutfit.csv b/csvfiles/special_lists/buildoutfit.csv index f8b4ae6..c623b8f 100644 --- a/csvfiles/special_lists/buildoutfit.csv +++ b/csvfiles/special_lists/buildoutfit.csv @@ -1,6 +1,6 @@ -OR(;-descriptor-;normal) OR(;-color-;uncommon) OR(;-culture-;uncommon) OR(;-material-;rare) -outfit- -OR(;-descriptor-;normal) OR(;-descriptor-;uncommon) OR(;-color-;uncommon) -outfit- -OR(-job-;-rpgclass-;-season-;-animal--style) OR(-minioutfit-;-outfit-;rare) -OR(;-descriptor-;uncommon) OR(-minioutfit-;-outfit-;rare) OR(;designed by -brand-;uncommon) -OR(-material-;-color-) -OR(;-descriptor-;-material-;-color-;uncommon) OR(-outfit-;-minioutfit-;rare) with OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print- \ No newline at end of file +OR(wearing;dressed in;in;normal) OR(;-descriptor-;normal) OR(;-color-;uncommon) OR(;-culture-;uncommon) OR(;-material-;rare) -outfit- +OR(wearing;dressed in;in;normal) OR(;-descriptor-;normal) OR(;-descriptor-;uncommon) OR(;-color-;uncommon) -outfit- +OR(wearing;dressed in;in;normal) OR(-job-;-rpgclass-;-season-;-animal--style) OR(-minioutfit-;-outfit-;rare) +OR(wearing;dressed in;in;normal) OR(;-descriptor-;uncommon) OR(-minioutfit-;-outfit-;rare) OR(;designed by -brand-;uncommon) +wearing OR(-material-;-color-) +OR(wearing;dressed in;in;normal) OR(;-descriptor-;-material-;-color-;uncommon) OR(-outfit-;-minioutfit-;rare) with OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print- diff --git a/prompttester.py b/prompttester.py index 0013686..1c8ecc4 100644 --- a/prompttester.py +++ b/prompttester.py @@ -51,4 +51,4 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im print("") print("All done!") -generateprompts(10,5,"all","all","all",False,"","","PREFIXPROMPT" ,"SUFFIXPROMPT","",1,"","",True,"",100, "all", "all", "all", "all", False, True) \ No newline at end of file +generateprompts(10,5,"humanoid","all","all",False,"","","PREFIXPROMPT" ,"SUFFIXPROMPT -sameoutfit-","",1,"","",True,"",100, "all", "all", "all", "all", False, True) \ No newline at end of file