Refactor PromptGenerator to process clip_l, clip_g, and t5xxl strings while trying to understand how SD3 works.
Can still use the ordinary prompt
This commit is contained in:
+92
-93
@@ -1,95 +1,94 @@
|
||||
[
|
||||
"indoor",
|
||||
"outdoor",
|
||||
"at night",
|
||||
"in the park",
|
||||
"studio",
|
||||
"at a party",
|
||||
"at a festival",
|
||||
"at a concert",
|
||||
"on persons home planet",
|
||||
"magical portal with particles",
|
||||
"in a neon lit city",
|
||||
"in a cyberpunk city",
|
||||
"in a fantasy world",
|
||||
"glamour photography",
|
||||
"fashion photography",
|
||||
"at home",
|
||||
"at work",
|
||||
"at a cafe",
|
||||
"at a gym",
|
||||
"at a hotel",
|
||||
"at a concert performance",
|
||||
"at the beach",
|
||||
"at a museum",
|
||||
"in a hidden city deep in the rainforest",
|
||||
"in a floating island in the sky",
|
||||
"in an underground world beneath the earths surface ",
|
||||
"in a secret garden hidden in a mysterious maze",
|
||||
"in a grand castle on the top of a remote mountain",
|
||||
"in a enchanted forest with talking animals and magical creatures",
|
||||
"in a mystical island filled with ancient ruins and hidden treasure",
|
||||
"in a faraway planet with a unique and alien landscape",
|
||||
"in a hidden paradise hidden behind a waterfall",
|
||||
"in a dreamlike world where anything is possible and the impossible is real",
|
||||
"in a hidden oasis in the desert",
|
||||
"in a secret underground city",
|
||||
"in an underwater kingdom",
|
||||
"in a lost temple in the jungle",
|
||||
"in a castle in the clouds",
|
||||
"in a hidden valley in the mountains",
|
||||
"in a uturistic city on a distant planet",
|
||||
"in a mystical land of eternal twilight",
|
||||
"Smoke and ash in the air",
|
||||
"suburban america",
|
||||
"suburbs",
|
||||
"slums",
|
||||
"at the sea",
|
||||
"at the ocean",
|
||||
"at the lake",
|
||||
"at the river",
|
||||
"at the waterfall",
|
||||
"in the labyrinth",
|
||||
"in a lab",
|
||||
"rendered in a 2.5D isometric perspective. Soft gradients add dimension, pastel color scheme",
|
||||
"in an ancient enchanted forest",
|
||||
"atop a floating sky island",
|
||||
"inside a crystal cavern",
|
||||
"beside a shimmering fairy pond",
|
||||
"in the ruins of a forgotten temple",
|
||||
"at the heart of a magical vortex",
|
||||
"on the steps of a celestial palace",
|
||||
"in the lair of a mythical beast",
|
||||
"on the shores of an eldritch sea",
|
||||
"within the walls of a dreamer's fortress",
|
||||
"in a neon-lit back alley market",
|
||||
"atop a towering megastructure",
|
||||
"inside a virtual reality dive bar",
|
||||
"beneath the city in the techno catacombs",
|
||||
"on the bustling streets of the augmented metropolis",
|
||||
"at a clandestine hacker's hideout",
|
||||
"in a hover-car chase through the cityscape",
|
||||
"at a black market cybernetics clinic",
|
||||
"within a digital data fortress in cyberspace",
|
||||
"on a rain-soaked rooftop overlooking the neon sprawl",
|
||||
"aboard a sprawling interstellar spaceship",
|
||||
"on a distant planet's alien landscape",
|
||||
"inside a high-tech orbital space station",
|
||||
"at a bustling galactic trade hub",
|
||||
"within the depths of a biomechanical hive",
|
||||
"on a terraformed Martian colony",
|
||||
"in the heart of a quantum singularity",
|
||||
"at a futuristic AI-controlled mega-city",
|
||||
"within the virtual realms of a digital utopia",
|
||||
"on the observation deck of a cosmic observatory",
|
||||
"inside the belly of a gigantic jellyfish floating in space",
|
||||
"on a floating island made entirely of candy and sweets",
|
||||
"within a dimension where colors sing and sounds have taste",
|
||||
"at a bazaar selling bottled dreams and captured starlight",
|
||||
"on a roller coaster weaving through time and memories",
|
||||
"in a library where books sprout legs and share their tales",
|
||||
"on a planet where the oceans are made of liquid crystal",
|
||||
"at a dance party hosted by interdimensional beings on the rings of Saturn",
|
||||
"inside a giant clockwork orange (literally a clock inside an orange fruit)",
|
||||
"on a beach where the sand is made of tiny glowing stars"
|
||||
"indoor",
|
||||
"outdoor",
|
||||
"at night",
|
||||
"in the park",
|
||||
"studio",
|
||||
"at a party",
|
||||
"at a festival",
|
||||
"at a concert",
|
||||
"on persons home planet",
|
||||
"magical portal with particles",
|
||||
"in a neon lit city",
|
||||
"in a cyberpunk city",
|
||||
"in a fantasy world",
|
||||
"glamour photography",
|
||||
"fashion photography",
|
||||
"at home",
|
||||
"at work",
|
||||
"at a cafe",
|
||||
"at a gym",
|
||||
"at a hotel",
|
||||
"at a concert performance",
|
||||
"at the beach",
|
||||
"at a museum",
|
||||
"in a hidden city deep in the rainforest",
|
||||
"in a floating island in the sky",
|
||||
"in an underground world beneath the earths surface ",
|
||||
"in a secret garden hidden in a mysterious maze",
|
||||
"in a grand castle on the top of a remote mountain",
|
||||
"in a enchanted forest with talking animals and magical creatures",
|
||||
"in a mystical island filled with ancient ruins and hidden treasure",
|
||||
"in a faraway planet with a unique and alien landscape",
|
||||
"in a hidden paradise hidden behind a waterfall",
|
||||
"in a dreamlike world where anything is possible and the impossible is real",
|
||||
"in a hidden oasis in the desert",
|
||||
"in a secret underground city",
|
||||
"in an underwater kingdom",
|
||||
"in a lost temple in the jungle",
|
||||
"in a castle in the clouds",
|
||||
"in a hidden valley in the mountains",
|
||||
"in a uturistic city on a distant planet",
|
||||
"in a mystical land of eternal twilight",
|
||||
"Smoke and ash in the air",
|
||||
"suburban america",
|
||||
"suburbs",
|
||||
"slums",
|
||||
"at the sea",
|
||||
"at the ocean",
|
||||
"at the lake",
|
||||
"at the river",
|
||||
"at the waterfall",
|
||||
"in the labyrinth",
|
||||
"in a lab",
|
||||
"rendered in a 2.5D isometric perspective. Soft gradients add dimension, pastel color scheme",
|
||||
"in an ancient enchanted forest",
|
||||
"atop a floating sky island",
|
||||
"inside a crystal cavern",
|
||||
"beside a shimmering fairy pond",
|
||||
"in the ruins of a forgotten temple",
|
||||
"at the heart of a magical vortex",
|
||||
"on the steps of a celestial palace",
|
||||
"in the lair of a mythical beast",
|
||||
"on the shores of an eldritch sea",
|
||||
"within the walls of a dreamer's fortress",
|
||||
"in a neon-lit back alley market",
|
||||
"atop a towering megastructure",
|
||||
"inside a virtual reality dive bar",
|
||||
"beneath the city in the techno catacombs",
|
||||
"on the bustling streets of the augmented metropolis",
|
||||
"at a clandestine hacker's hideout",
|
||||
"in a hover-car chase through the cityscape",
|
||||
"at a black market cybernetics clinic",
|
||||
"within a digital data fortress in cyberspace",
|
||||
"on a rain-soaked rooftop overlooking the neon sprawl",
|
||||
"aboard a sprawling interstellar spaceship",
|
||||
"on a distant planet's alien landscape",
|
||||
"inside a high-tech orbital space station",
|
||||
"at a bustling galactic trade hub",
|
||||
"within the depths of a biomechanical hive",
|
||||
"on a terraformed Martian colony",
|
||||
"in the heart of a quantum singularity",
|
||||
"at a futuristic AI-controlled mega-city",
|
||||
"within the virtual realms of a digital utopia",
|
||||
"on the observation deck of a cosmic observatory",
|
||||
"inside the belly of a gigantic jellyfish floating in space",
|
||||
"on a floating island made entirely of candy and sweets",
|
||||
"within a dimension where colors sing and sounds have taste",
|
||||
"at a bazaar selling bottled dreams and captured starlight",
|
||||
"on a roller coaster weaving through time and memories",
|
||||
"in a library where books sprout legs and share their tales",
|
||||
"on a planet where the oceans are made of liquid crystal",
|
||||
"at a dance party hosted by interdimensional beings on the rings of Saturn",
|
||||
"on a beach where the sand is made of tiny glowing stars"
|
||||
]
|
||||
+47
-13
@@ -40,10 +40,16 @@ class PromptGenerator:
|
||||
RETURN_TYPES = (
|
||||
"STRING",
|
||||
"INT",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING"
|
||||
)
|
||||
RETURN_NAMES = (
|
||||
"prompt",
|
||||
"seed",
|
||||
"clip_l",
|
||||
"clip_g",
|
||||
"t5xxl"
|
||||
)
|
||||
FUNCTION = "generate_prompt"
|
||||
CATEGORY = "PromptGenerator"
|
||||
@@ -63,7 +69,7 @@ class PromptGenerator:
|
||||
"subject": ("STRING", {}),
|
||||
"artform": (
|
||||
["disabled"] + ["random"] + ARTFORM,
|
||||
{"default": "random"},
|
||||
{"default": "photography"},
|
||||
),
|
||||
"photo_type": (
|
||||
["disabled"] + ["random"] + PHOTO_TYPE,
|
||||
@@ -141,6 +147,36 @@ class PromptGenerator:
|
||||
cleaned_string = re.sub(r',\s*,', ',', input_string)
|
||||
return cleaned_string
|
||||
|
||||
def process_string(self, replaced, seed):
|
||||
# Find the indices for "BREAK_CLIP"
|
||||
first_break_clip_index = replaced.find("BREAK_CLIP")
|
||||
second_break_clip_index = replaced.find("BREAK_CLIP", first_break_clip_index + len("BREAK_CLIP"))
|
||||
|
||||
# Extract the content between "BREAK_CLIP" markers
|
||||
if first_break_clip_index != -1 and second_break_clip_index != -1:
|
||||
clip_content = replaced[first_break_clip_index + len("BREAK_CLIP, "):second_break_clip_index].strip(", ")
|
||||
|
||||
# Update the replaced string by removing the "BREAK_CLIP" content
|
||||
replaced = replaced[:first_break_clip_index].strip(", ") + replaced[second_break_clip_index + len("BREAK_CLIP"):].strip(", ")
|
||||
|
||||
# Update clip_l and clip_g with the extracted content
|
||||
clip_l = clip_content
|
||||
clip_g = clip_content
|
||||
else:
|
||||
clip_l = ""
|
||||
clip_g = ""
|
||||
|
||||
t5xxl = replaced
|
||||
|
||||
|
||||
# print(f"PromptGenerator String: {replaced}")
|
||||
|
||||
print(f"clip_l / clip_g: {clip_l}")
|
||||
|
||||
print(f"t5xxl: {t5xxl}")
|
||||
|
||||
return replaced, seed, clip_l, clip_g, t5xxl
|
||||
|
||||
def generate_prompt(self, **kwargs):
|
||||
seed = kwargs.get("seed", 0)
|
||||
if seed is not None:
|
||||
@@ -255,7 +291,7 @@ class PromptGenerator:
|
||||
kwargs.get("pose", ""), POSE
|
||||
)
|
||||
components.append(pose)
|
||||
|
||||
components.append("BREAK_CLIP ")
|
||||
if kwargs.get("background", "") != "disabled" and kwargs.get("background", "") != "random":
|
||||
components.append(", ")
|
||||
background = kwargs.get("background", "")
|
||||
@@ -279,7 +315,7 @@ class PromptGenerator:
|
||||
components.append(place)
|
||||
|
||||
|
||||
|
||||
components.append("BREAK_CLIP ")
|
||||
lighting = kwargs.get("lighting", "").lower()
|
||||
if lighting == "random":
|
||||
selected_lighting = ", ".join(
|
||||
@@ -290,7 +326,9 @@ class PromptGenerator:
|
||||
pass
|
||||
else:
|
||||
components.append(", ")
|
||||
|
||||
components.append(lighting)
|
||||
components.append(" BREAK ")
|
||||
if is_photographer:
|
||||
|
||||
|
||||
@@ -326,7 +364,7 @@ class PromptGenerator:
|
||||
components.append(f"{digital_artform_choice}")
|
||||
if kwargs.get("artist", "") != "disabled":
|
||||
components.append(f"by {self.get_choice(kwargs.get('artist', ''), ARTIST)}")
|
||||
|
||||
|
||||
prompt = " ".join(components)
|
||||
prompt = re.sub(" +", " ", prompt)
|
||||
print(f"PromptGenerator Seed : {seed}")
|
||||
@@ -336,20 +374,16 @@ class PromptGenerator:
|
||||
replaced = replaced.replace(";", ", ")
|
||||
replaced = self.clean_consecutive_commas(replaced)
|
||||
print(f"PromptGenerator String: {replaced}")
|
||||
return (
|
||||
replaced,
|
||||
seed,
|
||||
)
|
||||
|
||||
|
||||
return self.process_string(replaced, seed)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"PromptGenerator": PromptGenerator,
|
||||
# "CSVPromptGenerator": CSVPromptGenerator,
|
||||
# "CSL": CommaSeparatedList,
|
||||
}
|
||||
|
||||
# Human readable names for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"PromptGenerator": "SDXL Auto Prompter",
|
||||
"CSL": "Comma Separated List",
|
||||
}
|
||||
"PromptGenerator": "Auto Prompter",
|
||||
}
|
||||
Reference in New Issue
Block a user