CLIPTextEncodeWildcards3
This commit is contained in:
@@ -31,7 +31,7 @@ class CLIPTextEncodeWildcards:
|
||||
def encode(self, clip, text):
|
||||
print(f"[green]text : [/green]",text)
|
||||
r=wildcards.run(text)
|
||||
print(f"[green]encode : [/green]",r)
|
||||
print(f"[green]result : [/green]",r)
|
||||
return ([[clip.encode(r), {}]], )
|
||||
|
||||
class CLIPTextEncodeWildcards2:
|
||||
@@ -53,5 +53,36 @@ class CLIPTextEncodeWildcards2:
|
||||
random.seed(seed)
|
||||
print(f"[green]text : [/green]",text)
|
||||
r=wildcards.run(text)
|
||||
print(f"[green]encode : [/green]",r)
|
||||
print(f"[green]result : [/green]",r)
|
||||
return ([[clip.encode(r), {}]], )
|
||||
|
||||
|
||||
|
||||
class CLIPTextEncodeWildcards3:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"clip": ("CLIP", ),
|
||||
"positive": ("STRING", {"multiline": True}),
|
||||
"negative": ("STRING", {"multiline": True}),
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("CONDITIONING","CONDITIONING")
|
||||
FUNCTION = "encode"
|
||||
|
||||
CATEGORY = "conditioning"
|
||||
|
||||
def encode(self, seed, clip, positive, negative):
|
||||
random.seed(seed)
|
||||
print(f"[green]positive : [/green]",positive)
|
||||
positive=wildcards.run(positive)
|
||||
print(f"[green]result : [/green]",positive)
|
||||
print(f"[green]negative : [/green]",negative)
|
||||
negative=wildcards.run(negative)
|
||||
print(f"[green]result : [/green]",negative)
|
||||
return ([[clip.encode(positive), {}]], [[clip.encode(negative), {}]], )
|
||||
|
||||
|
||||
|
||||
+9
-5
@@ -44,13 +44,17 @@ if not md.startswith("custom_nodes."):
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
}
|
||||
|
||||
def add(name,list=None):
|
||||
def add(name,clist=None):
|
||||
#print(f"Load : {name}")
|
||||
try:
|
||||
pkg = importlib.import_module(f"{md}.{name}")
|
||||
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
||||
if type(list) is str:
|
||||
NODE_CLASS_MAPPINGS[list]=eval(f"pkg.{list}")
|
||||
if clist is None:
|
||||
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
||||
elif type(clist) is str:
|
||||
NODE_CLASS_MAPPINGS[clist]=eval(f"pkg.{clist}")
|
||||
elif type(clist) is list:
|
||||
for c in clist:
|
||||
NODE_CLASS_MAPPINGS[c]=eval(f"pkg.{c}")
|
||||
print(f"Load ok : {name}", style="bold green")
|
||||
except Exception:
|
||||
console.print_exception()
|
||||
@@ -59,7 +63,7 @@ if not md.startswith("custom_nodes."):
|
||||
|
||||
add("CheckpointLoaderRandom")
|
||||
add("CheckpointLoaderSimpleText")
|
||||
add("CLIPTextEncodeWildcards","CLIPTextEncodeWildcards2")
|
||||
add("CLIPTextEncodeWildcards",["CLIPTextEncodeWildcards","CLIPTextEncodeWildcards2","CLIPTextEncodeWildcards3"])
|
||||
add("LoraLoaderText")
|
||||
add("LoraLoaderTextRandom")
|
||||
add("Random_Sampler")
|
||||
|
||||
Reference in New Issue
Block a user