From 08151c1ee9c88d5c6c32a235689db3735563f08b Mon Sep 17 00:00:00 2001 From: AIrjen Date: Tue, 20 Feb 2024 10:27:01 +0100 Subject: [PATCH 1/5] Support for Stable Cascade --- OneButtonPromptNodes.py | 19 +++++++++++------- build_dynamic_prompt.py | 40 ++++++++++++++++++++++++++++++-------- negativeprompttester.py | 6 +++--- prompttester.py | 7 ++++--- scripts/onebuttonprompt.py | 24 ++++++++++++++++------- 5 files changed, 68 insertions(+), 28 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index 934f78a..b94a96c 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -23,6 +23,7 @@ subjects =["all", "object", "animal", "humanoid", "landscape", "concept"] genders = ["all", "male", "female"] emojis = [False, True] +models = ["SD1.5", "SDXL", "Stable Cascade"] subjects =["all"] subjectsubtypesobject = ["all"] subjectsubtypeshumanoid = ["all"] @@ -229,6 +230,7 @@ class OneButtonPrompt: "humanoids_gender": (genders, {"default": "all"}), "subject_subtypes_concepts": (subjectsubtypesconcept, {"default": "all"}), "emojis":(emojis, {"default": False}), + "base_model":(models, {"default": "SD1.5"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, @@ -243,8 +245,8 @@ class OneButtonPrompt: CATEGORY = "OneButtonPrompt" - def Comfy_OBP(self, insanitylevel, custom_subject, seed, artist, imagetype, subject, imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, emojis, custom_outfit): - generatedpromptlist = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False, emojis, seed, custom_outfit, True) + def Comfy_OBP(self, insanitylevel, custom_subject, seed, artist, imagetype, subject, imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, emojis, custom_outfit, base_model): + generatedpromptlist = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False, emojis, seed, custom_outfit, True, base_model) #print(generatedprompt) generatedprompt = generatedpromptlist[0] prompt_g = generatedpromptlist[1] @@ -451,7 +453,8 @@ class OneButtonPreset: "required": { "OneButtonPreset": (allpresets, {"default": "Standard"}), }, - "optional": { + "optional": { + "base_model":(models, {"default": "SD1.5"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, } @@ -466,7 +469,7 @@ class OneButtonPreset: CATEGORY = "OneButtonPrompt" - def Comfy_OBP_OneButtonPreset(self, OneButtonPreset, seed): + def Comfy_OBP_OneButtonPreset(self, OneButtonPreset, seed, base_model): # load the stuff selected_opb_preset = OBPresets.get_obp_preset(OneButtonPreset) @@ -505,7 +508,8 @@ class OneButtonPreset: antivalues=antistring, advancedprompting=False, hardturnoffemojis=True, - seed=seed + seed=seed, + base_model=base_model, ) @@ -541,6 +545,7 @@ class AutoNegativePrompt: "max": 10, #Maximum value "step": 1 #Slider's step }), + "base_model":(models, {"default": "SD1.5"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, @@ -555,8 +560,8 @@ class AutoNegativePrompt: CATEGORY = "OneButtonPrompt" - def Comfy_OBP_AutoNegativePrompt(self, postive_prompt, insanitylevel, enhancenegative,base_negative, seed): - generatedprompt = build_dynamic_negative(postive_prompt, insanitylevel, enhancenegative, base_negative) + def Comfy_OBP_AutoNegativePrompt(self, postive_prompt, insanitylevel, enhancenegative,base_negative, seed, base_model): + generatedprompt = build_dynamic_negative(postive_prompt, insanitylevel, enhancenegative, base_negative, base_model=base_model) print("Generated negative prompt: " + generatedprompt) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 3d13d47..beddbb1 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -10,7 +10,10 @@ from random_functions import * # 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): +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, base_model = "SD1.5"): + + remove_weights = False + # set seed # For use in ComfyUI (might bring to Automatic1111 as well) @@ -45,6 +48,16 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # clean up antivalue list: antilist = [s.strip().lower() for s in antilist] + # Base model options, used to change things in prompt generation. Might be able to extend to different forms like animatediff as well? + base_model_options = ["SD1.5", "SDXL", "Stable Cascade"] + if base_model not in base_model_options: + base_model = "SD1.5" # Just in case there is no option here. + # "SD1.5" -- Standard, future: More original style prompting + # "SDXL" -- Standard (for now), future: More natural language + # "Stable Cascade" -- Remove weights + if base_model == "Stable Cascade": + remove_weights = True + # Some tricks for gender to make sure we can choose Him/Her/It etc on the right time. if(gender=="all"): genderchoicelist = ["male", "female"] @@ -1456,7 +1469,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all completeprompt += " [" while step < end: - if(normal_dist(insanitylevel)): + if(normal_dist(insanitylevel) and remove_weights == False): isweighted = 1 if isweighted == 1: @@ -1546,7 +1559,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all if(thetokinatormode == True): tokinatorsubtype = ["personification", "human form", "object", "landscape", "OR(creature;beast;animal;myth;concept;world;planet)", "building", "location", "shape", "being", "-token-"] if(chance_roll(insanitylevel,"normal")): - if(chance_roll(insanitylevel,"normal")): + if(chance_roll(insanitylevel,"normal") and remove_weights == False): completeprompt += "(OR(;-imagetypequality-;uncommon) OR(-imagetype-;-othertype-;rare):1.3) " else: completeprompt += "OR(;-imagetypequality-;uncommon) OR(-imagetype-;-othertype-;rare) " @@ -2274,7 +2287,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all completeprompt += " [" while step < end: - if(normal_dist(insanitylevel)): + if(normal_dist(insanitylevel) and remove_weights == False): isweighted = 1 if isweighted == 1: @@ -2600,7 +2613,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all completeprompt += " [" while step < end: - if(normal_dist(insanitylevel)): + if(normal_dist(insanitylevel) and remove_weights == False): isweighted = 1 if isweighted == 1: @@ -2984,7 +2997,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all matches = re.findall(pattern, givensubject) - if(len(completeprompt) > 325 and matches == []): + if(len(completeprompt) > 325 and matches == [] and remove_weights == False): if(len(completeprompt) < 375): strenght = "1.1" elif(len(completeprompt) < 450): @@ -3863,12 +3876,23 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy return completeprompt -def build_dynamic_negative(positive_prompt = "", insanitylevel = 0, enhance = False, existing_negative_prompt = ""): +def build_dynamic_negative(positive_prompt = "", insanitylevel = 0, enhance = False, existing_negative_prompt = "", base_model="SD1.5"): negative_primer = [] negative_result = [] all_negative_words_list = [] + remove_weights = False + + # Base model options, used to change things in prompt generation. Might be able to extend to different forms like animatediff as well? + base_model_options = ["SD1.5", "SDXL", "Stable Cascade"] + if base_model not in base_model_options: + base_model = "SD1.5" # Just in case there is no option here. + # "SD1.5" -- Standard, future: More original style prompting + # "SDXL" -- Standard (for now), future: More natural language + # "Stable Cascade" -- Remove weights + if base_model == "Stable Cascade": + remove_weights = True # negavite_primer, all words that should trigger a negative result # the negative words to put in the negative prompt @@ -3937,7 +3961,7 @@ def build_dynamic_negative(positive_prompt = "", insanitylevel = 0, enhance = Fa # Convert the list to unique values or (word:count) format unique_words = [] for word, count in word_count.items(): - if(count > 2): + if(count > 2 and remove_weights == False): #counttotal = int(count/2) counttotal = count if(counttotal > 3): diff --git a/negativeprompttester.py b/negativeprompttester.py index 95e93ee..58866e8 100644 --- a/negativeprompttester.py +++ b/negativeprompttester.py @@ -10,7 +10,7 @@ from build_dynamic_prompt import * -def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=False,existing_negative_prompt=""): +def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=False,existing_negative_prompt="", base_model= "SD1.5"): loops = int(amount) # amount of images to generate steps = 0 @@ -19,7 +19,7 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=Fa # build prompt if positive_prompt == "": positive_prompt = build_dynamic_prompt() - result = build_dynamic_negative(positive_prompt=positive_prompt, insanitylevel=insanitylevel,enhance=enhance, existing_negative_prompt=existing_negative_prompt) + result = build_dynamic_negative(positive_prompt=positive_prompt, insanitylevel=insanitylevel,enhance=enhance, existing_negative_prompt=existing_negative_prompt, base_model=base_model) print("negative prompt: " + result) print("") print("loop " + str(steps)) @@ -32,4 +32,4 @@ def generateprompts(amount = 1,positive_prompt = "",insanitylevel="0",enhance=Fa print("") print("All done!") -generateprompts(1,"art by van gogh, a celestial being",0,False,"") \ No newline at end of file +generateprompts(1,"photo, photograph, realism",0,False,"", base_model="Stable Cascade") \ No newline at end of file diff --git a/prompttester.py b/prompttester.py index 2b75d73..e5e2b22 100644 --- a/prompttester.py +++ b/prompttester.py @@ -10,7 +10,7 @@ from build_dynamic_prompt import * -def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", imagetype="all",onlyartists=False, workprompt="", antistring="",prefixprompt="", suffixprompt="", negativeprompt="",promptcompounderlevel = "1", seperator="comma",givensubject="",smartsubject=True,giventypeofimage="",imagemodechance=20, gender = "all", subtypeobject = "all", subtypehumanoid = "all", subtypeconcept = "all", advancedprompting = True, hardturnoffemojis=False, seed=0, overrideoutfit="", prompt_g_and_l = False): +def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", imagetype="all",onlyartists=False, workprompt="", antistring="",prefixprompt="", suffixprompt="", negativeprompt="",promptcompounderlevel = "1", seperator="comma",givensubject="",smartsubject=True,giventypeofimage="",imagemodechance=20, gender = "all", subtypeobject = "all", subtypehumanoid = "all", subtypeconcept = "all", advancedprompting = True, hardturnoffemojis=False, seed=0, overrideoutfit="", prompt_g_and_l = False, base_model = "SD1.5"): loops = int(amount) # amount of images to generate steps = 0 @@ -18,7 +18,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im while steps < loops: # build prompt if(prompt_g_and_l == True): - resultlist = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, onlyartists,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, subtypeobject, subtypehumanoid, subtypeconcept, advancedprompting, hardturnoffemojis, seed, overrideoutfit, prompt_g_and_l) + resultlist = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, onlyartists,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, subtypeobject, subtypehumanoid, subtypeconcept, advancedprompting, hardturnoffemojis, seed, overrideoutfit, prompt_g_and_l, base_model) result = resultlist[0] print("prompt_g") print(resultlist[1]) @@ -26,7 +26,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im print(resultlist[2]) else: - result = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, onlyartists,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, subtypeobject, subtypehumanoid, subtypeconcept, advancedprompting, hardturnoffemojis, seed, overrideoutfit, prompt_g_and_l) + result = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, onlyartists,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, subtypeobject, subtypehumanoid, subtypeconcept, advancedprompting, hardturnoffemojis, seed, overrideoutfit, prompt_g_and_l, base_model) print("") print("loop " + str(steps)) print("") @@ -115,4 +115,5 @@ generateprompts(10,5 , 0 # seed , "" #outfit override , False #prompt_g_and_l + , "Stable Cascade" #base model ) \ No newline at end of file diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index cd750a0..b9ba46f 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -18,6 +18,7 @@ from csv_reader import * from one_button_presets import OneButtonPresets OBPresets = OneButtonPresets() +basemodelslist = ["SD1.5", "SDXL", "Stable Cascade"] #subjects = ["all","object","animal","humanoid", "landscape", "concept"] subjects =["all"] subjectsubtypesobject = ["all"] @@ -233,12 +234,12 @@ class Script(scripts.Script): def ui(self, is_img2img): - def gen_prompt(insanitylevel, subject, artist, imagetype, antistring, prefixprompt, suffixprompt, promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,givenoutfit): + def gen_prompt(insanitylevel, subject, artist, imagetype, antistring, prefixprompt, suffixprompt, promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,givenoutfit, base_model): promptlist = [] for i in range(5): - promptlist.append(build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring,prefixprompt,suffixprompt,promptcompounderlevel,seperator,givensubject,smartsubject, giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit)) + promptlist.append(build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring,prefixprompt,suffixprompt,promptcompounderlevel,seperator,givensubject,smartsubject, giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit,False,base_model)) return promptlist @@ -627,6 +628,15 @@ class Script(scripts.Script): with gr.Column(variant="compact"): prompt5toworkflow = gr.Button("⬆️🛠️💬") with gr.Tab("Advanced"): + with gr.Row(variant="compact"): + gr.Markdown(""" + + Base model will try and generate prompts fitting the selected model. + + """ + ) + base_model = gr.Dropdown( + basemodelslist, label=" Base model", value="SD1.5") with gr.Row(variant="compact"): with gr.Column(variant="compact"): promptcompounderlevel = gr.Dropdown( @@ -1201,12 +1211,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, autonegativeprompt, autonegativepromptstrength, autonegativepromptenhance] + 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, base_model] - 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): + 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, base_model): images = [] infotexts = [] @@ -1253,7 +1263,7 @@ class Script(scripts.Script): if(ANDtoggle == "automatic"): if(artist != "none"): - preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, True, antistring) + preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, True, antistring, base_model=base_model) if(subject == "humanoid"): preppedprompt += ", " + promptcompounderlevel + " people" if(subject == "landscape"): @@ -1280,7 +1290,7 @@ class Script(scripts.Script): #Here is where we build a "normal" prompt - preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring, prefixprompt, suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit) + preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring, prefixprompt, suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept,True,False,-1,givenoutfit, False, base_model) # set the artist mode back when done (for automatic mode) artist = artistcopy @@ -1301,7 +1311,7 @@ class Script(scripts.Script): 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) + p.negative_prompt = build_dynamic_negative(positive_prompt=p.prompt, insanitylevel=autonegativepromptstrength,enhance=autonegativepromptenhance, existing_negative_prompt=p.negative_prompt, base_model=base_model) promptlist = [] From 4ee26e224096b8dcaee7d4093d1b83b45a0f79fb Mon Sep 17 00:00:00 2001 From: AIrjen Date: Tue, 20 Feb 2024 17:21:30 +0100 Subject: [PATCH 2/5] more mode stuff! --- build_dynamic_prompt.py | 90 +++++++++++++++---- csvfiles/human_activities_less_verbose.csv | 61 +++++++++++++ csvfiles/outfitvomit.csv | 2 +- .../buildaccessorie_less_verbose.csv | 1 + .../special_lists/buildface_less_verbose.csv | 5 ++ .../special_lists/buildhair_less_verbose.csv | 2 + csvfiles/special_lists/buildoutfit.csv | 4 +- .../buildoutfit_less_verbose.csv | 14 +++ csvfiles/special_lists/humanadditions.csv | 3 +- .../humanadditions_less_verbose.csv | 19 ++++ .../objectadditions_less_verbose.csv | 9 ++ main.py | 6 +- prompttester.py | 5 +- scripts/onebuttonprompt.py | 2 +- 14 files changed, 193 insertions(+), 30 deletions(-) create mode 100644 csvfiles/human_activities_less_verbose.csv create mode 100644 csvfiles/special_lists/buildaccessorie_less_verbose.csv create mode 100644 csvfiles/special_lists/buildface_less_verbose.csv create mode 100644 csvfiles/special_lists/buildhair_less_verbose.csv create mode 100644 csvfiles/special_lists/buildoutfit_less_verbose.csv create mode 100644 csvfiles/special_lists/humanadditions_less_verbose.csv create mode 100644 csvfiles/special_lists/objectadditions_less_verbose.csv diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index beddbb1..7de58f8 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -13,6 +13,7 @@ from random_functions import * 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, base_model = "SD1.5"): remove_weights = False + less_verbose = False # set seed @@ -55,8 +56,10 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # "SD1.5" -- Standard, future: More original style prompting # "SDXL" -- Standard (for now), future: More natural language # "Stable Cascade" -- Remove weights - if base_model == "Stable Cascade": + if(base_model == "Stable Cascade"): remove_weights = True + if(base_model == "SD1.5"): + less_verbose = True # Some tricks for gender to make sure we can choose Him/Her/It etc on the right time. if(gender=="all"): @@ -103,7 +106,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all 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) @@ -187,15 +190,23 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all humanlist = fictionallist + nonfictionallist + humanoidlist 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-)", + if(less_verbose): + humanactivitycheatinglist = ["-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)", + "-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-)"] + else: + 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)" @@ -283,19 +294,34 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all 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,"?") + if(less_verbose): + buildhairlist = csv_to_list("buildhair_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + buildoutfitlist = csv_to_list("buildoutfit_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + humanadditionlist = csv_to_list("humanadditions_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + objectadditionslist = csv_to_list("objectadditions_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + buildfacelist = csv_to_list("buildface_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + buildaccessorielist = csv_to_list("buildaccessorie_less_verbose", antilist,"./csvfiles/special_lists/",0,"?") + humanactivitylist = csv_to_list("human_activities_less_verbose",antilist,"./csvfiles/",0,"?",False,False) + else: + buildhairlist = csv_to_list("buildhair", antilist,"./csvfiles/special_lists/",0,"?") + buildoutfitlist = csv_to_list("buildoutfit", antilist,"./csvfiles/special_lists/",0,"?") + humanadditionlist = csv_to_list("humanadditions", antilist,"./csvfiles/special_lists/",0,"?") + objectadditionslist = csv_to_list("objectadditions", antilist,"./csvfiles/special_lists/",0,"?") + buildfacelist = csv_to_list("buildface", antilist,"./csvfiles/special_lists/",0,"?") + buildaccessorielist = csv_to_list("buildaccessorie", antilist,"./csvfiles/special_lists/",0,"?") + humanactivitylist = csv_to_list("human_activities",antilist,"./csvfiles/",0,"?",False,False) + + humanactivitylist = humanactivitylist + humanactivitycheatinglist + 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,"?") + tokinatorlist = csv_to_list("tokinator", antilist,"./csvfiles/templates/",0,"?") styleslist = csv_to_list("styles", antilist,"./csvfiles/templates/",0,"?") @@ -2076,28 +2102,51 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # 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(less_verbose): + completeprompt += ", -humandescriptor- " + elif(random.randint(0,3) > 0): completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -humandescriptor- " 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"): - completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -locationdescriptor- " + if(less_verbose): + completeprompt += ", -locationdescriptor- " + else: + completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -locationdescriptor- " elif(mainchooser == "animal"): - completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -animaldescriptor- " + if(less_verbose): + completeprompt += ", -animaldescriptor- " + else: + completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -animaldescriptor- " else: - completeprompt += ", OR(;-heshe- is;normal) OR(;very;rare) -descriptor- " + if(less_verbose): + completeprompt += ", -descriptor- " + else: + 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"]): - completeprompt += " and -humandescriptor- " + if(less_verbose): + completeprompt += ", -humandescriptor- " + else: + completeprompt += " and -humandescriptor- " elif(mainchooser == "landscape"): - completeprompt += " and -locationdescriptor- " + if(less_verbose): + completeprompt += ", -locationdescriptor- " + else: + completeprompt += " and -locationdescriptor- " elif(mainchooser == "animal"): - completeprompt += " and -animaldescriptor- " + if(less_verbose): + completeprompt += ", -animaldescriptor- " + else: + completeprompt += " and -animaldescriptor- " else: - completeprompt += " and -descriptor- " + if(less_verbose): + completeprompt += ", -descriptor- " + else: + completeprompt += " and -descriptor- " completeprompt += ", " if(thetokinatormode == False): @@ -4094,6 +4143,8 @@ def cleanup(completeprompt, advancedprompting, insanitylevel = 5): 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: @@ -4194,6 +4245,7 @@ def custom_or(values, insanitylevel = 5): return selected_value def parse_custom_functions(completeprompt, insanitylevel = 5): + print(completeprompt) # Regular expression pattern to match 'or()' function calls and their arguments ORpattern = r'OR\((.*?)\)' diff --git a/csvfiles/human_activities_less_verbose.csv b/csvfiles/human_activities_less_verbose.csv new file mode 100644 index 0000000..e35873e --- /dev/null +++ b/csvfiles/human_activities_less_verbose.csv @@ -0,0 +1,61 @@ +Walking +Running +Jumping +Laying down +Swimming +Dancing +Frolicking +OR(Painting a painting;Drawing a drawing) +Singing +Writing +Cooking +Reading +Hiking +Camping +Fishing +Hunting +Making photographs +OR(Sculpting;Knitting;Sewing;Quilting;Woodworking;Blacksmithing;Metalworking;Pottery;Glassblowing) +Playing video games +Watching OR(movies;TV shows;cinema) +Playing OR(board games;card games;chess;poker;trivia games;word games) +Doing puzzles +Collecting OR(stamps;coins;art;antiques) +OR(Playing a musical instrument;Composing music;Producing music;DJing) +Singing in a choir +Playing in a OR(band;orchestra) +OR(Blogging;Vlogging;Podcasting) +Speaking in public +OR(Stand-up;Improvisational) comedy +OR(Acting in;Directing;Producing) a OR(play;movie;TV show) +OR(Teaching;Coaching;Mentoring;Tutoring) +OR(Fundraising;Campaigning for a cause;Activism;Participating in a protest) +OR(Gardening;Landscaping) +Home improvement +Cleaning +OR(Organizing;Planning events;Hosting parties) +Attending OR(concerts;festivals;theater performances;movies;sports events) +OR(Exercising;Going to the gym;Fitnessing) +OR(Yoga;Pilates;Tai chi) +Meditating +OR(Scuba diving;Snorkeling;Kayaking;Canoeing;Rafting;Climbing;Bungee jumping;Skydiving;Paragliding;Hang gliding;Zip lining) +OR(Traveling;Exploring new places) +Playing OR(Tennis;Basketball;Soccer;Football;Golf;Baseball;Hockey;Icehockey;Volleyball;Beach Volleyball;Sports) +OR(Boxing;Wrestling;Doing Martial Arts;Gymnastics;Cycling;Surfing;Skateboarding;Snowboarding;Skiing;Figure Skating;Rowing;Sailing;Cycling;Mountain biking) +Diving +Playing +Horse-back riding +-animal--back riding +having a tea party +Lounging +Bathing in a -waterlocation- +drinking coffee in a cafe +studying in a room +doing a fashion show +fighting a War +sieging a Castle +sitting and talking +Walking up a stairs +Walking down a stairs +Walking down a OR(street;-minilocation-) +casting a -element- magic spell \ No newline at end of file diff --git a/csvfiles/outfitvomit.csv b/csvfiles/outfitvomit.csv index 3f3d471..2ff64bf 100644 --- a/csvfiles/outfitvomit.csv +++ b/csvfiles/outfitvomit.csv @@ -13,6 +13,6 @@ also has a OR(;large;flowing;rare) OR(hooded cloak;cloak;cape;coat;-season- coat rolled up sleeves is in the style of -artmovement- -outfitdescriptor- and -outfitdescriptor- --materialcombination-;-colorcombination- +OR(-materialcombination-;-colorcombination-) OR(fishnets;trinkets;bling) with a OR(asymetrical;bateau;grecian;collar;cowl;halter;illusion;jewel;keyhole;off-the-shoulder;one-shoulder;plunging;queen anne;round neck;scalloped;scoop;spaghetti strap;split crew;square;strapless;surplice;sweethearth;tie bow;turtleneck;U-shape;V-neck) neckline \ No newline at end of file diff --git a/csvfiles/special_lists/buildaccessorie_less_verbose.csv b/csvfiles/special_lists/buildaccessorie_less_verbose.csv new file mode 100644 index 0000000..548bf0f --- /dev/null +++ b/csvfiles/special_lists/buildaccessorie_less_verbose.csv @@ -0,0 +1 @@ +OR(;-descriptor-;normal) OR(;-culture-;uncommon) OR(;-color-;uncommon) -accessory- OR(; , -accessory-; , -descriptor- -accessory-;rare) OR(; and -accessory-;unique) \ No newline at end of file diff --git a/csvfiles/special_lists/buildface_less_verbose.csv b/csvfiles/special_lists/buildface_less_verbose.csv new file mode 100644 index 0000000..a4675ef --- /dev/null +++ b/csvfiles/special_lists/buildface_less_verbose.csv @@ -0,0 +1,5 @@ +combination of OR(-nonfictional-;-fictional-;legendary) OR(;, OR(-nonfictional-;-fictional-;legendary);rare) and OR(-nonfictional-;-fictional-;legendary) +-facepart- of OR(-nonfictional-;-fictional-;legendary), -facepart- of OR(-nonfictional-;-fictional-;legendary) +OR(;very;legendary) -buildfacepart- OR(; OR(,;and) -buildfacepart-;normal) OR(; and -buildfacepart-;legendary) +OR(;very;legendary) -humandescriptor- -facepart- OR(; and -humandescriptor- -facepart-;uncommon) +-facepart- of OR(-conceptsuffix-;-basicbitchdescriptor-;uncommon) OR(; and -facepart- of OR(-conceptsuffix-;-basicbitchdescriptor-;uncommon);uncommon) \ No newline at end of file diff --git a/csvfiles/special_lists/buildhair_less_verbose.csv b/csvfiles/special_lists/buildhair_less_verbose.csv new file mode 100644 index 0000000..e941070 --- /dev/null +++ b/csvfiles/special_lists/buildhair_less_verbose.csv @@ -0,0 +1,2 @@ +OR(-haircolor-;-hairdescriptor-;-culture-;uncommon) hair OR(styled as -hairstyle-;, ;rare) +OR(-haircolor-; -hairstyle-) OR(hairstyle;hair) \ No newline at end of file diff --git a/csvfiles/special_lists/buildoutfit.csv b/csvfiles/special_lists/buildoutfit.csv index 7a75f3e..8a122e3 100644 --- a/csvfiles/special_lists/buildoutfit.csv +++ b/csvfiles/special_lists/buildoutfit.csv @@ -2,13 +2,13 @@ , OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;normal) OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit- OR(;from the OR(-age-;the -agecalculator-);rare) , OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;normal) OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit- OR(; and OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit-;rare) , OR(wearing;dressed in;in;normal) OR(-job-;-rpgclass-;-season-;-animal--style) OR(-minioutfit-;-outfit-;rare) -, OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;uncommon) OR(-minioutfit-;-outfit-;rare) OR(;OR(designed;made;inspired;forged) by OR(-brand-;-fashiondesigner-);uncommon) +, OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;uncommon) OR(-minioutfit-;-outfit-;rare) OR(;OR(designed;made;inspired;forged) by OR(-brand-;-fashiondesigner-);rare) , wearing OR(-material-;-color-;-element-;uncommon) -overrideoutfit- , OR(wearing;dressed in;in;normal) OR(;-outfitdescriptor-;-material-;-color-;uncommon) OR(-outfit-;-minioutfit-;rare) with OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print-, , -heshe- is OR(wearing a;dressed in) OR(;-hisher-;-hisher- -outfitdescriptor-;rare) -outfit-, OR(-hisher-;The;normal) -sameoutfit- is OR(-outfitdescriptor-;-color-) OR( OR(and has;, It has) OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print- on it,; and is OR(made of;detailed with bits of) -material-;rare) OR(;, It looks OR(;very;rare) -outfitdescriptor- on -himher-,;unique) , -heshe- is OR(wearing;dressed in) OR(;-hisher-;rare) -culture- -outfit-, OR(; OR(-hisher-;The;normal) -sameoutfit- is OR(-outfitdescriptor-;-color-),;normal) OR(;, It looks OR(;very;rare) -outfitdescriptor- on -himher-,;unique) , -heshe- is OR(wearing a;dressed in a) OR(;-outfitdescriptor-;normal) OR(;-color-;uncommon) OR(;-culture-;uncommon) OR(;-material-;rare) -outfit- that was OR(designed;made;inspired;forged) by -brand-, It is OR(;very;rare) OR(-outfitdescriptor-;-color-;normal) OR(;and OR(-outfitdescriptor-;-color-;normal);normal) OR(;, The -sameoutfit- looks OR(;very;rare) -outfitdescriptor- on -himher-,;unique) , OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;normal) OR(-minioutfit-;-outfit-;uncommon), OR(-hisher-;The;normal) -sameoutfit- -outfitvomit- -, -heshe- is OR(wearing a;dressed in) OR(;-hisher-;-hisher- -outfitdescriptor-;rare) -outfit-, OR(-hisher-;The;normal) -sameoutfit- OR(is tailored by -fashiondesigner- OR(; and -fashiondesigner-;uncommon);is inspired by the -charactertype- OR(;and -charactertype-;uncommon)) +, -heshe- is OR(wearing a;dressed in) OR(;-hisher-;-hisher- -outfitdescriptor-;rare) -outfit-, OR(-hisher-;The;normal) -sameoutfit- OR(is tailored by -fashiondesigner- OR(; and -fashiondesigner-;uncommon);is inspired by the -charactertype- OR(;and -charactertype-;rare)) , -heshe- is OR(wearing a;dressed in) OR(;-hisher-;-hisher- -outfitdescriptor-;rare) -artmovement- fashion style -outfit- , OR(wearing;dressed in;in;normal) OR(;OR(;a very;rare) -outfitdescriptor-;normal) -outfit- \ No newline at end of file diff --git a/csvfiles/special_lists/buildoutfit_less_verbose.csv b/csvfiles/special_lists/buildoutfit_less_verbose.csv new file mode 100644 index 0000000..b5093b4 --- /dev/null +++ b/csvfiles/special_lists/buildoutfit_less_verbose.csv @@ -0,0 +1,14 @@ +, OR(;-outfitdescriptor-;normal) OR(;-color-;uncommon) OR(;-culture-;uncommon) OR(;-material-;rare) -outfit- OR(;from the OR(-age-;the -agecalculator-);rare) +, OR(;-outfitdescriptor-;normal) OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit- OR(;from the OR(-age-;the -agecalculator-);rare) +, OR(;-outfitdescriptor-;normal) OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit- OR(; and OR(;-outfitdescriptor-;uncommon) OR(;-color-;uncommon) -outfit-;rare) +, OR(-job-;-rpgclass-;-season-;-animal--style) OR(-minioutfit-;-outfit-;rare) +, OR(;-outfitdescriptor-;uncommon) OR(-minioutfit-;-outfit-;rare) OR(;OR(designed;made;inspired;forged) by OR(-brand-;-fashiondesigner-);rare) +, OR(-material-;-color-;-element-;uncommon) -overrideoutfit- +, OR(;-outfitdescriptor-;-material-;-color-;uncommon) OR(-outfit-;-minioutfit-;rare), OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print-, +, OR(;-outfitdescriptor-;normal) -outfit-, OR(-outfitdescriptor-;-color-), OR(-pattern-;-outfitprinttotal-;-material-;uncommon) -print- OR(;-material-;rare) +, -culture- -outfit-, OR(;OR(-outfitdescriptor-;-color-),;normal) +, OR(;-outfitdescriptor-;normal) OR(;-color-;uncommon) OR(;-culture-;uncommon) OR(;-material-;rare) -outfit- that was OR(designed;made;inspired;forged) by -brand- +, OR(;-outfitdescriptor-;normal) OR(-minioutfit-;-outfit-;uncommon), -outfitvomit- +, OR(;-outfitdescriptor-;normal) -outfit-, OR(is tailored by -fashiondesigner- OR(; and -fashiondesigner-;uncommon);-charactertype- OR(;and -charactertype-;rare)) +, OR(;-outfitdescriptor-;normal) -artmovement- fashion style -outfit- +, OR(;-outfitdescriptor-;normal) -outfit- \ No newline at end of file diff --git a/csvfiles/special_lists/humanadditions.csv b/csvfiles/special_lists/humanadditions.csv index 03d112b..be048ae 100644 --- a/csvfiles/special_lists/humanadditions.csv +++ b/csvfiles/special_lists/humanadditions.csv @@ -15,4 +15,5 @@ OR(;, -heshe- is;rare) inside a -container- OR(;, -heshe- is;rare) OR(surrounded by;being looked at by) a OR(couple;group) of OR(;-descriptor-;uncommon) OR(people;-malefemale-s;animals) OR(;wearing OR(;-descriptor-;uncommon) -outfit-;rare) OR(;, -heshe- is;rare) from the OR(-age-;the -agecalculator-) OR(;, -heshe- is;uncommon) in a -setting- setting -OR(as a;OR(;, -heshe- is;uncommon) reimagined as a) -charactertype- character \ No newline at end of file +OR(as a;OR(;, -heshe- is;uncommon) reimagined as a) -charactertype- character +OR(;, -heshe- is;rare) dressed up as -fictional- character \ No newline at end of file diff --git a/csvfiles/special_lists/humanadditions_less_verbose.csv b/csvfiles/special_lists/humanadditions_less_verbose.csv new file mode 100644 index 0000000..232410d --- /dev/null +++ b/csvfiles/special_lists/humanadditions_less_verbose.csv @@ -0,0 +1,19 @@ +OR(riding;with) a -animal- +holding a OR(-objectstohold-;-object-;rare) +driving a -vehicle- +surrounded by OR(-object-s;-flora-s;-space-) +eating -food- +OR(and;holding hands with) -human- +cosplaying as -fictional- +OR(-color-;-material-) skin +-miniactivity- OR(in;at) a OR(-location-;-building-;-waterlocation-) +wearing -elaborateoutfit- +- OR(-animal-;-humanoid-) OR(;hybrid;normal) +-culture- -rpgclass- +sitting in a OR(;-descriptor-;uncommon) -chair- +inside a -container- +OR(surrounded by;being looked at by) a OR(couple;group) of OR(;-descriptor-;uncommon) OR(people;-malefemale-s;animals) OR(;wearing OR(;-descriptor-;uncommon) -outfit-;rare) +from the OR(-age-;the -agecalculator-) +-setting- +-charactertype- character +as -fictional- character \ No newline at end of file diff --git a/csvfiles/special_lists/objectadditions_less_verbose.csv b/csvfiles/special_lists/objectadditions_less_verbose.csv new file mode 100644 index 0000000..3baa0f0 --- /dev/null +++ b/csvfiles/special_lists/objectadditions_less_verbose.csv @@ -0,0 +1,9 @@ +made from OR(-material-;-space-;-flora-) +OR(detailed;engraved;rare) with OR(-material-;-color-;-outfitdescriptor-;-pattern-) OR(; and -color-; and -outfitdescriptor-;rare) OR(patterns;details) +OR(smooth;sleek) +OR(intricate;ornate;-basicbitchdescriptor-) details +OR(designed;made;inspired;forged) by -brand- +anthropomorphic OR(;with a face;as a -charactertype- character;common) +with OR(-pattern-;-color-;-descriptor-;rare) -print- +covered in -covering- +-setting- setting \ No newline at end of file diff --git a/main.py b/main.py index d7b40c0..34afcde 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 = "", autonegativeprompt = True, autonegativepromptstrength = 0, autonegativepromptenhance = False): +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, base_model = "SD1.5"): loops = int(amount) # amount of images to generate steps = 0 upscalefilelist=[] @@ -136,12 +136,12 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s else: - 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) + 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, base_model=base_model) randomprompt = randompromptlist[0] randomsubject = randompromptlist[1] if(autonegativeprompt): - negativeprompt = build_dynamic_negative(positive_prompt=randomprompt, insanitylevel=autonegativepromptstrength,enhance=autonegativepromptenhance, existing_negative_prompt=originalnegativeprompt) + negativeprompt = build_dynamic_negative(positive_prompt=randomprompt, insanitylevel=autonegativepromptstrength,enhance=autonegativepromptenhance, existing_negative_prompt=originalnegativeprompt, base_model=base_model) if(randomsubject == ""): # make the filename, from from a to the first comma diff --git a/prompttester.py b/prompttester.py index e5e2b22..f9325ae 100644 --- a/prompttester.py +++ b/prompttester.py @@ -88,14 +88,13 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im # print(result) # break - steps += 1 print("") print("All done!") -generateprompts(10,5 +generateprompts(1000,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" @@ -115,5 +114,5 @@ generateprompts(10,5 , 0 # seed , "" #outfit override , False #prompt_g_and_l - , "Stable Cascade" #base model + , "SD1.5" #base model ) \ No newline at end of file diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index b9ba46f..736b766 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -906,7 +906,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, autonegativeprompt, autonegativepromptstrength, autonegativepromptenhance]) + 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, base_model]) interrupt.click(tryinterrupt, inputs=[apiurl]) automatedoutputsfolderbutton.click(openfolder) From c60f325043937a7c12d58fdadb2074e2b85915f6 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Tue, 20 Feb 2024 17:48:07 +0100 Subject: [PATCH 3/5] Small fix --- build_dynamic_prompt.py | 2 +- prompttester.py | 2 +- scripts/onebuttonprompt.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 7de58f8..2b7e165 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -4245,7 +4245,7 @@ def custom_or(values, insanitylevel = 5): return selected_value def parse_custom_functions(completeprompt, insanitylevel = 5): - print(completeprompt) + #print(completeprompt) # Regular expression pattern to match 'or()' function calls and their arguments ORpattern = r'OR\((.*?)\)' diff --git a/prompttester.py b/prompttester.py index f9325ae..f5eeac0 100644 --- a/prompttester.py +++ b/prompttester.py @@ -94,7 +94,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im print("") print("All done!") -generateprompts(1000,5 +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" diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index 736b766..cbdfc7a 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -636,7 +636,7 @@ class Script(scripts.Script): """ ) base_model = gr.Dropdown( - basemodelslist, label=" Base model", value="SD1.5") + basemodelslist, label=" Base model", value="SDXL") with gr.Row(variant="compact"): with gr.Column(variant="compact"): promptcompounderlevel = gr.Dropdown( @@ -898,7 +898,7 @@ class Script(scripts.Script): extrasupscaler2codeformerweight = gr.Slider(0, 1, value="0.1", step=0.05, label="CodeFormer weight", visible = False) - genprom.click(gen_prompt, inputs=[insanitylevel,subject, artist, imagetype, antistring,prefixprompt, suffixprompt,promptcompounderlevel, seperator, givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, givenoutfit], outputs=[prompt1, prompt2, prompt3,prompt4,prompt5]) + genprom.click(gen_prompt, inputs=[insanitylevel,subject, artist, imagetype, antistring,prefixprompt, suffixprompt,promptcompounderlevel, seperator, givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept, givenoutfit, base_model], outputs=[prompt1, prompt2, prompt3,prompt4,prompt5]) prompt1toworkflow.click(prompttoworkflowprompt, inputs=prompt1, outputs=workprompt) prompt2toworkflow.click(prompttoworkflowprompt, inputs=prompt2, outputs=workprompt) From b00466fa4529ca480dc63439a5a40ac98c0b68a4 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Tue, 20 Feb 2024 20:21:06 +0100 Subject: [PATCH 4/5] text fixes --- prompttester.py | 2 +- scripts/onebuttonprompt.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/prompttester.py b/prompttester.py index f5eeac0..d3a5bd1 100644 --- a/prompttester.py +++ b/prompttester.py @@ -114,5 +114,5 @@ generateprompts(10,5 , 0 # seed , "" #outfit override , False #prompt_g_and_l - , "SD1.5" #base model + , "SDXL" #base model ) \ No newline at end of file diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index cbdfc7a..e8fa0e5 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -631,12 +631,19 @@ class Script(scripts.Script): with gr.Row(variant="compact"): gr.Markdown(""" - Base model will try and generate prompts fitting the selected model. + ✨Base model will try and generate prompts fitting the selected model. + + SD1.5 --> Less natural language + + SDXL --> More natural language (default) + + Stable Cascade --> More natural language and no prompt weights """ ) + with gr.Row(variant="compact"): base_model = gr.Dropdown( - basemodelslist, label=" Base model", value="SDXL") + basemodelslist, label="✨ Base model", value="SDXL") with gr.Row(variant="compact"): with gr.Column(variant="compact"): promptcompounderlevel = gr.Dropdown( From fce1cb6edc655e684bf1f92373b2099c802e7366 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Tue, 20 Feb 2024 20:22:49 +0100 Subject: [PATCH 5/5] move standard to SDXL --- OneButtonPromptNodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index b94a96c..5871d21 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -230,7 +230,7 @@ class OneButtonPrompt: "humanoids_gender": (genders, {"default": "all"}), "subject_subtypes_concepts": (subjectsubtypesconcept, {"default": "all"}), "emojis":(emojis, {"default": False}), - "base_model":(models, {"default": "SD1.5"}), + "base_model":(models, {"default": "SDXL"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, @@ -454,7 +454,7 @@ class OneButtonPreset: "OneButtonPreset": (allpresets, {"default": "Standard"}), }, "optional": { - "base_model":(models, {"default": "SD1.5"}), + "base_model":(models, {"default": "SDXL"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), }, } @@ -545,7 +545,7 @@ class AutoNegativePrompt: "max": 10, #Maximum value "step": 1 #Slider's step }), - "base_model":(models, {"default": "SD1.5"}), + "base_model":(models, {"default": "SDXL"}), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), },