From 213760e3b9b1149c95195a0e4600b40e382878f7 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Sat, 9 Mar 2024 17:13:43 +0100 Subject: [PATCH] in between commit --- build_dynamic_prompt.py | 68 +++++++++++++++++-- csvfiles/descriptors.csv | 1 + csvfiles/humandescriptors.csv | 2 + csvfiles/imagetypequality.csv | 6 +- csvfiles/imagetypes.csv | 3 +- csvfiles/imagetypes_light.csv | 2 +- csvfiles/imagetypes_medium.csv | 3 +- csvfiles/moods.csv | 2 + csvfiles/moods_medium.csv | 2 + csvfiles/poses.csv | 4 +- csvfiles/settings.csv | 2 + .../templates/dynamic_templates_prefix.csv | 11 +++ .../templates/dynamic_templates_suffix.csv | 10 +++ csvfiles/vomit.csv | 4 +- one_button_presets.py | 1 - prompttester.py | 4 +- 16 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 csvfiles/templates/dynamic_templates_prefix.csv create mode 100644 csvfiles/templates/dynamic_templates_suffix.csv diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index c1ed877..44af805 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -16,6 +16,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all remove_weights = False less_verbose = False + add_vomit = True + add_quality = True # set seed @@ -84,6 +86,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # "Stable Cascade" -- Remove weights if(base_model == "Stable Cascade"): remove_weights = True + add_vomit = False + add_quality = False if(base_model == "SD1.5"): less_verbose = True @@ -134,7 +138,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) humanoidlist = csv_to_list("humanoids",antilist) - imagetypelist = csv_to_list(csvfilename="imagetypes",antilist=antilist, insanitylevel=insanitylevel) + imagetypelist = csv_to_list(csvfilename="imagetypes",antilist=antilist, insanitylevel=insanitylevel, delimiter="?") 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) @@ -351,6 +355,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all tokinatorlist = csv_to_list("tokinator", antilist,"./csvfiles/templates/",0,"?") styleslist = csv_to_list("styles", antilist,"./csvfiles/templates/",0,"?") + dynamictemplatesprefixlist = csv_to_list("dynamic_templates_prefix", antilist,"./csvfiles/templates/",0,"?") + dynamictemplatessuffixlist = csv_to_list("dynamic_templates_suffix", antilist,"./csvfiles/templates/",0,"?") # subjects @@ -806,6 +812,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all onlysubjectmode = False stylesmode = False thetokinatormode = False + dynamictemplatesmode = False # determine wether we should go for a template or not. Not hooked up to insanitylevel if(imagetype == "only templates mode"): @@ -862,6 +869,10 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all print("Running with a completely random set of words") print("All safety and logic is turned off") + if(imagetype == "dynamic templates mode"): + specialmode = True + dynamictemplatesmode = True + print("Running with dynamic templates mode") # main stuff generatetype = not specialmode @@ -887,8 +898,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all generatelighting = bool(lightinglist) and not specialmode generatemood = bool(moodlist) and not specialmode generatepose = bool(poselist) and not templatemode - generatevomit = bool(vomitlist) and not specialmode - generatequality = bool(qualitylist) and not specialmode + generatevomit = bool(vomitlist) and not specialmode and add_vomit + generatequality = bool(qualitylist) and not specialmode and add_quality generateshot = bool(shotsizelist) and not specialmode generatetimeperiod = bool(timeperiodlist) and not specialmode generateemoji = bool(emojilist) and not templatemode @@ -913,8 +924,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all 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 + generateminivomit = bool(minivomitlist) and not specialmode and add_vomit + generateimagetypequality = bool(imagetypequalitylist) and not specialmode and generateimagetypequality generateoveralladdition = bool(overalladditionlist) and not specialmode generateimagetype = bool(imagetypelist) and not specialmode and generateimagetype @@ -1430,13 +1441,20 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all - # start styles mode here + # start styles mode here if(stylesmode == True): chosenstyle = random.choice(styleslist) chosenstyleprefix = chosenstyle.split("-subject-")[0] chosenstylesuffix= chosenstyle.split("-subject-")[1] completeprompt += chosenstyleprefix + if(dynamictemplatesmode == True): + chosenstyleprefix = random.choice(dynamictemplatesprefixlist) + completeprompt += chosenstyleprefix + if(chosenstyleprefix[-1] == "."): + completeprompt += " OR(Capturing a; Describing a;Portraying a;Featuring a)" + else: + completeprompt += " OR(with a;capturing a; describing a;portraying a;of a;featuring a)" # start artist part @@ -2609,6 +2627,28 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # start styles mode here if(stylesmode == True): completeprompt += chosenstylesuffix + + if(dynamictemplatesmode == True): + if("-artist-" in completeprompt): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-artist-" not in sentence.lower()] + if("-lighting-" in completeprompt): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-lighting-" not in sentence.lower()] + if("-shotsize-" in completeprompt): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-shotsize-" not in sentence.lower()] + if("-artmovement-" in completeprompt): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-artmovement-" not in sentence.lower()] + if("-imagetype-" in completeprompt or "-othertype-" in completeprompt ): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-imagetype-" not in sentence.lower()] + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-othertype-" not in sentence.lower()] + if("-colorcombination-" in completeprompt or "-colorscheme" in completeprompt ): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-colorcombination-" not in sentence.lower()] + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-colorscheme-" not in sentence.lower()] + if("-mood-" in completeprompt or "-humanexpression" in completeprompt ): + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-mood-" not in sentence.lower()] + dynamictemplatessuffixlist = [sentence for sentence in dynamictemplatessuffixlist if "-humanexpression-" not in sentence.lower()] + + chosenstylesuffix = random.choice(dynamictemplatessuffixlist) + completeprompt += ". " + chosenstylesuffix # custom style list @@ -2773,7 +2813,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # In front and the back? - completeprompt = parse_custom_functions(completeprompt, insanitylevel) + if(dynamictemplatesmode == False): + completeprompt = parse_custom_functions(completeprompt, insanitylevel) # Sometimes change he/she to the actual subject # Doesnt work if someone puts in a manual subject @@ -4173,6 +4214,8 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): completeprompt = re.sub(' ,', ',', completeprompt) completeprompt = re.sub(',\(', ', (', completeprompt) + + while " " in completeprompt: completeprompt = re.sub(' ', ' ', completeprompt) completeprompt = re.sub('a The', 'The', completeprompt) @@ -4194,10 +4237,15 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): completeprompt = re.sub('art art', 'art', completeprompt) + completeprompt = re.sub('Art art', 'art', completeprompt) + completeprompt = re.sub('lighting lighting', 'lighting', completeprompt) + completeprompt = re.sub('light lighting', 'light', 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('shot shot', 'shot', completeprompt) completeprompt = re.sub('a his', 'his', completeprompt) @@ -4243,6 +4291,12 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): # Move the extracted LoRA's to the end of completeprompt #completeprompt += " " + " ".join(allLoRA) + completeprompt = completeprompt.replace(' . ', '. ') + completeprompt = completeprompt.replace(', . ', '. ') + completeprompt = completeprompt.replace(',. ', '. ') + completeprompt = completeprompt.replace('., ', '. ') + completeprompt = completeprompt.replace('. . ', '. ') + completeprompt = completeprompt.strip(", ") return completeprompt diff --git a/csvfiles/descriptors.csv b/csvfiles/descriptors.csv index a971b11..04d3243 100644 --- a/csvfiles/descriptors.csv +++ b/csvfiles/descriptors.csv @@ -213,6 +213,7 @@ Extreme Fairy-Tale Fallacious Familiar +Fae Fantastical Fascinating Fashionable diff --git a/csvfiles/humandescriptors.csv b/csvfiles/humandescriptors.csv index 5e464ac..9fd181f 100644 --- a/csvfiles/humandescriptors.csv +++ b/csvfiles/humandescriptors.csv @@ -82,6 +82,7 @@ Exotic Expressive Extraordinary Fairy-Tale +Fae Fantastical Fantasy Fashionable @@ -174,6 +175,7 @@ Shabby Smart Smiling Spellbinding +Spiritual Stressed Striking Stunning diff --git a/csvfiles/imagetypequality.csv b/csvfiles/imagetypequality.csv index 159d0bf..160e2c8 100644 --- a/csvfiles/imagetypequality.csv +++ b/csvfiles/imagetypequality.csv @@ -14,4 +14,8 @@ colorful vibrant dramatic artistic --basicbitchdescriptor- \ No newline at end of file +-basicbitchdescriptor- +candid +amateurish +top-notch +superb \ No newline at end of file diff --git a/csvfiles/imagetypes.csv b/csvfiles/imagetypes.csv index 1863e7d..4b85d8f 100644 --- a/csvfiles/imagetypes.csv +++ b/csvfiles/imagetypes.csv @@ -35,4 +35,5 @@ Airbrush painting On pale black paper On pale -color- paper Anime -Cinematic still \ No newline at end of file +Cinematic still +OR(;2D;3D;uncommon) Game art \ No newline at end of file diff --git a/csvfiles/imagetypes_light.csv b/csvfiles/imagetypes_light.csv index 7538ab1..dea6b70 100644 --- a/csvfiles/imagetypes_light.csv +++ b/csvfiles/imagetypes_light.csv @@ -1,7 +1,7 @@ RAW photo Photograph Digital art -3D Rendering +OR(;2D;3D;uncommon) Game art Concept art Portrait Anime diff --git a/csvfiles/imagetypes_medium.csv b/csvfiles/imagetypes_medium.csv index c4984f8..e71005f 100644 --- a/csvfiles/imagetypes_medium.csv +++ b/csvfiles/imagetypes_medium.csv @@ -14,4 +14,5 @@ Portrait Raw digital photo On pale black paper Anime -Cinematic still \ No newline at end of file +Cinematic still +OR(;2D;3D;uncommon) Game art \ No newline at end of file diff --git a/csvfiles/moods.csv b/csvfiles/moods.csv index 5ea090d..291c418 100644 --- a/csvfiles/moods.csv +++ b/csvfiles/moods.csv @@ -11,6 +11,7 @@ Disgusting Embarrassing Energetic Evil +Fae Fantasy Fairy-Tale Fearful @@ -39,6 +40,7 @@ Satisfying Sci-Fi Shameful Shameless +Spiritual Suffering Surprising Tranquil diff --git a/csvfiles/moods_medium.csv b/csvfiles/moods_medium.csv index 96b694e..b211d30 100644 --- a/csvfiles/moods_medium.csv +++ b/csvfiles/moods_medium.csv @@ -7,6 +7,7 @@ Dark Depressing Energetic Evil +Fae Fantasy Fairy-Tale Fearful @@ -29,6 +30,7 @@ Romantic Sad Satisfying Sci-Fi +Spiritual Suffering Surprising Tranquil diff --git a/csvfiles/poses.csv b/csvfiles/poses.csv index 48ab7f5..3da8810 100644 --- a/csvfiles/poses.csv +++ b/csvfiles/poses.csv @@ -75,4 +75,6 @@ frolicking in a -minilocation- pointe pose Dancing and looking at camera Walking towards camera -Walking away from camera \ No newline at end of file +Walking away from camera +peace sign pose +-humanexpression- pose \ No newline at end of file diff --git a/csvfiles/settings.csv b/csvfiles/settings.csv index fa5374b..9ae1bc0 100644 --- a/csvfiles/settings.csv +++ b/csvfiles/settings.csv @@ -5,6 +5,7 @@ Lord of the Rings Blade runner D&D Cyberpunk +Fae Fantasy Dark Fantasy Corporate @@ -31,5 +32,6 @@ Matrix Mad Max Harry Potter Shadowrun +Spirit world Neo-Tokyo Steampunk \ No newline at end of file diff --git a/csvfiles/templates/dynamic_templates_prefix.csv b/csvfiles/templates/dynamic_templates_prefix.csv new file mode 100644 index 0000000..72c85c7 --- /dev/null +++ b/csvfiles/templates/dynamic_templates_prefix.csv @@ -0,0 +1,11 @@ +a OR(-imagetype-;-artiststyle-;OR(-imagetype-;-artiststyle-;-othertype-;-artmovement-;OR(-colorscheme-;-colorcombination-))) OR(artwork;art) OR(by;designed by;stylized by;uncommon) -artist-, a OR(-artiststyle-;-imagetypequality-) OR(art;work;artwork) OR(with a OR(touch;splash;hint) of OR(-colorcombination- colors;-color-;-colorscheme-);reminiscent of -artmovement-;inspired by -artmovement-;taking influence from -artmovement-). +a OR(-imagetype-;-artiststyle-;OR(-imagetype-;-artiststyle-;-othertype-;-artmovement-;OR(-colorscheme-;-colorcombination-))) OR(artwork;art) OR(by;designed by;stylized by;uncommon) -artist-, a OR(-artiststyle-;-imagetypequality-) OR(art;work;artwork) +a OR(;-imagetypequality-;uncommon) a OR(;-imagetype-;uncommon) artwork in OR(;-imagetypequality-;uncommon) -artmovement- style +a OR(;-shotsize- shot;uncommon) -descriptor- -imagetype- artwork inspired by OR(-setting- setting;-culture- setting). +a OR(-colorscheme-;-colorcombination-) OR(;-basicbitchdescriptor-;-imagetypequality-;uncommon) OR(OR(;gradient;uncommon)background;art;artwork;image) +a OR(-imagetype-;-othertype-) OR(artwork;art) +a OR(;-shotsize- shot;uncommon) OR(;-photoaddition-;uncommon) photograph OR(;shot with a -camera-;shot with a -lens- lens;uncommon) +Combining the styles of -artist- OR(;, -artist-;rare) and -artist-, this OR(;-artiststyle-;uncommon) OR(;-imagetypequality-;uncommon) image +OR(Unique;one of a kind;-basicbitchdescriptor-) art in the form of a -othertype-. +Capturing the OR(;feeling of;uncommon) -mood- OR(atmosphere;mood;ambience;energy;vibes), this -direction- OR(work;scene;image;art;artwork) +The very -descriptor- OR(artwork;art;image;scene) is inspired by OR(-imagetype-;-othertype-;-artmovement-;OR(-colorscheme-;-colorcombination-)) \ No newline at end of file diff --git a/csvfiles/templates/dynamic_templates_suffix.csv b/csvfiles/templates/dynamic_templates_suffix.csv new file mode 100644 index 0000000..b9cc1fc --- /dev/null +++ b/csvfiles/templates/dynamic_templates_suffix.csv @@ -0,0 +1,10 @@ +OR(Describing;Evoking) a sense of OR(-mood-;-descriptor-) OR(under;in;that is) -lighting- lighting. OR(;It is -quality-.;uncommon) +It has OR(-colorcombination- colors;-color-;-colorscheme-) details. +It is OR(evoking;capturing) the feeling of being -mood-. +The quality is OR(;very;uncommon) -imagetypequality-. OR(; OR(The art has a;The artist used a;The image uses a;It has a;Including a) -vomit- type effect.;uncommon) +The OR(artwork;art;image) is OR(by;designed by;stylized by) -artist- OR(;in a -artiststyle- style;uncommon). +The -lighting- OR(art is -basicbitchdescriptor-;art is of -imagetypequality- quality;enhances the image). +The overall style of the image is OR(-artmovement-;inspired by -artmovement-;inspired by -setting-). +The -direction- OR(work;scene;image;art;artwork) OR(exudes;has) OR(-imagetypequality-;-mood-) vibes. +The OR(work;scene;image;art;artwork) is -quality-. OR(;It is OR(captured in;lit by) -lighting- lighting.;uncommon) +It is set on a OR(-color-;-colorscheme-;-colorcombination-) background. \ No newline at end of file diff --git a/csvfiles/vomit.csv b/csvfiles/vomit.csv index aef4a89..9045fe3 100644 --- a/csvfiles/vomit.csv +++ b/csvfiles/vomit.csv @@ -20,7 +20,7 @@ -color- splash -colorcombination- -space- -(-color- and -color-:0.7) +-color- and -color- arcane Batik behance @@ -62,6 +62,7 @@ Encaustic Paint epic fantasy ethereal magical atmosphere expressive brush strokes +fae folkore fairy tale Film grain Floral motifs @@ -126,6 +127,7 @@ Simplified style sloppy strokes Soutache Spirals +Spirit world stylized sunbeam surreal design diff --git a/one_button_presets.py b/one_button_presets.py index 0e4b0cd..b4292bc 100644 --- a/one_button_presets.py +++ b/one_button_presets.py @@ -1,7 +1,6 @@ import json import os import shutil -import random class OneButtonPresets: diff --git a/prompttester.py b/prompttester.py index e4701da..d9ae9a1 100644 --- a/prompttester.py +++ b/prompttester.py @@ -97,7 +97,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im generateprompts(10,5 ,"all" # subject ,"all" # artists - ,"all" # image type "only other types", "only templates mode", "art blaster mode", "quality vomit mode", "color cannon mode", "unique art mode", "massive madness mode", "photo fantasy mode", "subject only mode", "fixed styles mode" + ,"dynamic templates mode" # image type "only other types", "only templates mode", "art blaster mode", "quality vomit mode", "color cannon mode", "unique art mode", "massive madness mode", "photo fantasy mode", "subject only mode", "fixed styles mode" , False # only artists ,"","","PREFIXPROMPT" ,"SUFFIXPROMPT" @@ -115,5 +115,5 @@ generateprompts(10,5 , "" #outfit override , False #prompt_g_and_l , "Stable Cascade" #base model - , "All (random)..." #preset "All (random)..." + , "" #preset "All (random)..." ) \ No newline at end of file