mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-18 10:20:16 +08:00
Merge branch 'comfyanonymous:master' into master
This commit is contained in:
commit
d16487f4e6
@ -1,24 +1,24 @@
|
|||||||
from nodes import MAX_RESOLUTION
|
from nodes import MAX_RESOLUTION
|
||||||
|
|
||||||
class CLIPTextEncodePixArtAlpha:
|
class CLIPTextEncodePixArtAlpha:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required": {
|
return {"required": {
|
||||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||||
# "aspect_ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
# "aspect_ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||||
"text": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),
|
"text": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),
|
||||||
}}
|
}}
|
||||||
|
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
FUNCTION = "encode"
|
FUNCTION = "encode"
|
||||||
CATEGORY = "advanced/conditioning"
|
CATEGORY = "advanced/conditioning"
|
||||||
DESCRIPTION = "Encodes text and sets the resolution conditioning for PixArt Alpha. Does not apply to PixArt Sigma."
|
DESCRIPTION = "Encodes text and sets the resolution conditioning for PixArt Alpha. Does not apply to PixArt Sigma."
|
||||||
|
|
||||||
def encode(self, clip, width, height, text):
|
def encode(self, clip, width, height, text):
|
||||||
tokens = clip.tokenize(text)
|
tokens = clip.tokenize(text)
|
||||||
return (clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}),)
|
return (clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}),)
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"CLIPTextEncodePixArtAlpha": CLIPTextEncodePixArtAlpha,
|
"CLIPTextEncodePixArtAlpha": CLIPTextEncodePixArtAlpha,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.23.4
|
comfyui-frontend-package==1.23.4
|
||||||
comfyui-workflow-templates==0.1.35
|
comfyui-workflow-templates==0.1.36
|
||||||
comfyui-embedded-docs==0.2.4
|
comfyui-embedded-docs==0.2.4
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
|
|||||||
@ -10,11 +10,11 @@ import urllib.parse
|
|||||||
server_address = "127.0.0.1:8188"
|
server_address = "127.0.0.1:8188"
|
||||||
client_id = str(uuid.uuid4())
|
client_id = str(uuid.uuid4())
|
||||||
|
|
||||||
def queue_prompt(prompt):
|
def queue_prompt(prompt, prompt_id):
|
||||||
p = {"prompt": prompt, "client_id": client_id}
|
p = {"prompt": prompt, "client_id": client_id, "prompt_id": prompt_id}
|
||||||
data = json.dumps(p).encode('utf-8')
|
data = json.dumps(p).encode('utf-8')
|
||||||
req = urllib.request.Request("http://{}/prompt".format(server_address), data=data)
|
req = urllib.request.Request("http://{}/prompt".format(server_address), data=data)
|
||||||
return json.loads(urllib.request.urlopen(req).read())
|
urllib.request.urlopen(req).read()
|
||||||
|
|
||||||
def get_image(filename, subfolder, folder_type):
|
def get_image(filename, subfolder, folder_type):
|
||||||
data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
|
data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
|
||||||
@ -27,7 +27,8 @@ def get_history(prompt_id):
|
|||||||
return json.loads(response.read())
|
return json.loads(response.read())
|
||||||
|
|
||||||
def get_images(ws, prompt):
|
def get_images(ws, prompt):
|
||||||
prompt_id = queue_prompt(prompt)['prompt_id']
|
prompt_id = str(uuid.uuid4())
|
||||||
|
queue_prompt(prompt, prompt_id)
|
||||||
output_images = {}
|
output_images = {}
|
||||||
while True:
|
while True:
|
||||||
out = ws.recv()
|
out = ws.recv()
|
||||||
|
|||||||
@ -678,7 +678,7 @@ class PromptServer():
|
|||||||
|
|
||||||
if "prompt" in json_data:
|
if "prompt" in json_data:
|
||||||
prompt = json_data["prompt"]
|
prompt = json_data["prompt"]
|
||||||
prompt_id = str(uuid.uuid4())
|
prompt_id = str(json_data.get("prompt_id", uuid.uuid4()))
|
||||||
valid = await execution.validate_prompt(prompt_id, prompt)
|
valid = await execution.validate_prompt(prompt_id, prompt)
|
||||||
extra_data = {}
|
extra_data = {}
|
||||||
if "extra_data" in json_data:
|
if "extra_data" in json_data:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user