From 24fb30f0dd9747d9d33541622309993f546d4ec0 Mon Sep 17 00:00:00 2001 From: kex0 <46696708+kex0@users.noreply.github.com> Date: Mon, 18 Sep 2023 16:46:03 +0200 Subject: [PATCH 1/3] Fix #130 Seed in OneButtonPrompt node now works --- OneButtonPromptNodes.py | 4 ++-- build_dynamic_prompt.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index 95f50e6..a76852d 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -219,8 +219,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): - generatedprompt = 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) + def Comfy_OBP(self, insanitylevel, custom_subject, seed, artist, imagetype, subject, imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, emojis): + generatedprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",seed,custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False, emojis) #print(generatedprompt) return (generatedprompt,) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index cc9b33b..086e363 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -10,9 +10,11 @@ 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): +def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all", imagetype = "all", onlyartists = False, antivalues = "", prefixprompt = "", suffixprompt ="",promptcompounderlevel ="1", seperator = "comma", seed=0, givensubject="",smartsubject = True,giventypeofimage="", imagemodechance = 20, gender = "all", subtypeobject="all", subtypehumanoid="all", subtypeconcept="all", advancedprompting=True, hardturnoffemojis=False): + + # set seed + random.seed(seed) - # load the config file config = load_config_csv() From 743c22495cae32f0d19b7ad9c387a481b3780497 Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:08:37 +0200 Subject: [PATCH 2/3] Changes to make sure it works on A1111 Moved seed to last part of the command. Changed so it only works when seed < 1, so it will keep working on A1111. --- OneButtonPromptNodes.py | 2 +- build_dynamic_prompt.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index a76852d..9cf3b09 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -220,7 +220,7 @@ 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): - generatedprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",seed,custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False, emojis) + generatedprompt = 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) #print(generatedprompt) return (generatedprompt,) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 086e363..fdd9b62 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -10,10 +10,14 @@ 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", seed=0, givensubject="",smartsubject = True,giventypeofimage="", imagemodechance = 20, gender = "all", subtypeobject="all", subtypehumanoid="all", subtypeconcept="all", advancedprompting=True, hardturnoffemojis=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): # set seed - random.seed(seed) + # For use in ComfyUI (might bring to Automatic1111 as well) + # lets do it when its lower than 1, to have it work on 0 and -1 + # Otherwise, just do nothing and it will keep on working based on an earlier set seed + if(seed < 1): + random.seed(seed) # load the config file config = load_config_csv() From 8ec0cdb43d4e8607ed995e6ac764891b86ffb9b0 Mon Sep 17 00:00:00 2001 From: AIrjen <130234949+AIrjen@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:12:33 +0200 Subject: [PATCH 3/3] Update build_dynamic_prompt.py fix stupid mistake --- build_dynamic_prompt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index fdd9b62..116d0eb 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -14,9 +14,9 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # set seed # For use in ComfyUI (might bring to Automatic1111 as well) - # lets do it when its lower than 1, to have it work on 0 and -1 + # 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 < 1): + if(seed > 0): random.seed(seed) # load the config file