Cleanup
This commit is contained in:
+8
-48
@@ -1,48 +1,8 @@
|
|||||||
NODE_CLASS_MAPPINGS = {}
|
# only import if running as a custom node
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {}
|
try:
|
||||||
|
import comfy.utils
|
||||||
def remote_control():
|
except ImportError:
|
||||||
global NODE_CLASS_MAPPINGS
|
pass
|
||||||
global NODE_DISPLAY_NAME_MAPPINGS
|
else:
|
||||||
from .nodes.remote_control import QueueRemoteChainStart, QueueRemoteChainEnd, QueueRemote, FetchRemote
|
from .nodes.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||||
NODE_CLASS_MAPPINGS.update({
|
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||||
"QueueRemoteChainStart": QueueRemoteChainStart,
|
|
||||||
"QueueRemoteChainEnd": QueueRemoteChainEnd,
|
|
||||||
"QueueRemote": QueueRemote,
|
|
||||||
"FetchRemote": FetchRemote,
|
|
||||||
})
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS.update({
|
|
||||||
"QueueRemoteChainStart": "Queue on remote (start of chain)",
|
|
||||||
"QueueRemoteChainEnd": "Queue on remote (end of chain)",
|
|
||||||
"QueueRemote": "Queue on remote",
|
|
||||||
"FetchRemote": "Fetch from remote",
|
|
||||||
})
|
|
||||||
|
|
||||||
def remote_images():
|
|
||||||
global NODE_CLASS_MAPPINGS
|
|
||||||
global NODE_DISPLAY_NAME_MAPPINGS
|
|
||||||
from .nodes.remote_images import LoadImageUrl, SaveImageUrl
|
|
||||||
NODE_CLASS_MAPPINGS.update({
|
|
||||||
"LoadImageUrl": LoadImageUrl,
|
|
||||||
"SaveImageUrl": SaveImageUrl,
|
|
||||||
})
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS.update({
|
|
||||||
"LoadImageUrl": "Load Image (URL)",
|
|
||||||
"SaveImageUrl": "Save Image (URL)",
|
|
||||||
})
|
|
||||||
|
|
||||||
def remote_misc():
|
|
||||||
global NODE_CLASS_MAPPINGS
|
|
||||||
global NODE_DISPLAY_NAME_MAPPINGS
|
|
||||||
from .nodes.misc import CombineImageBatch
|
|
||||||
NODE_CLASS_MAPPINGS.update({
|
|
||||||
"CombineImageBatch": CombineImageBatch,
|
|
||||||
})
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS.update({
|
|
||||||
"CombineImageBatch": "Combine images",
|
|
||||||
})
|
|
||||||
|
|
||||||
print("Loading network distribution node pack")
|
|
||||||
remote_control()
|
|
||||||
remote_images()
|
|
||||||
remote_misc()
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class FetchRemote():
|
|||||||
RETURN_TYPES = ("IMAGE",)
|
RETURN_TYPES = ("IMAGE",)
|
||||||
FUNCTION = "get_remote_job"
|
FUNCTION = "get_remote_job"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Fetch from remote"
|
||||||
|
|
||||||
def wait_for_job(self,remote_url,job_id):
|
def wait_for_job(self,remote_url,job_id):
|
||||||
url = remote_url + "history"
|
url = remote_url + "history"
|
||||||
@@ -94,6 +95,7 @@ class QueueRemoteChainStart:
|
|||||||
RETURN_NAMES = ("remote_chain_start",)
|
RETURN_NAMES = ("remote_chain_start",)
|
||||||
FUNCTION = "chain_start"
|
FUNCTION = "chain_start"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Queue on remote (start of chain)"
|
||||||
|
|
||||||
def chain_start(self, workflow, trigger, batch, seed, prompt):
|
def chain_start(self, workflow, trigger, batch, seed, prompt):
|
||||||
remote_chain = {
|
remote_chain = {
|
||||||
@@ -128,6 +130,7 @@ class QueueRemoteChainEnd:
|
|||||||
RETURN_NAMES = ("seed", "batch")
|
RETURN_NAMES = ("seed", "batch")
|
||||||
FUNCTION = "chain_end"
|
FUNCTION = "chain_end"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Queue on remote (end of chain)"
|
||||||
|
|
||||||
def chain_end(self, remote_chain_end):
|
def chain_end(self, remote_chain_end):
|
||||||
seed = remote_chain_end["current_seed"]
|
seed = remote_chain_end["current_seed"]
|
||||||
@@ -163,6 +166,7 @@ class QueueRemote:
|
|||||||
RETURN_NAMES = ("remote_chain", "remote_info")
|
RETURN_NAMES = ("remote_chain", "remote_info")
|
||||||
FUNCTION = "queue_on_remote"
|
FUNCTION = "queue_on_remote"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Queue on remote"
|
||||||
|
|
||||||
def queue_on_remote(self, remote_chain, remote_url, system, batch_override, enabled):
|
def queue_on_remote(self, remote_chain, remote_url, system, batch_override, enabled):
|
||||||
batch = batch_override if batch_override > 0 else remote_chain["batch"]
|
batch = batch_override if batch_override > 0 else remote_chain["batch"]
|
||||||
@@ -23,6 +23,7 @@ class LoadImageUrl:
|
|||||||
RETURN_TYPES = ("IMAGE", "MASK")
|
RETURN_TYPES = ("IMAGE", "MASK")
|
||||||
FUNCTION = "load_image_url"
|
FUNCTION = "load_image_url"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Load Image (URL)"
|
||||||
|
|
||||||
def load_image_url(self, url):
|
def load_image_url(self, url):
|
||||||
with requests.get(url, stream=True) as r:
|
with requests.get(url, stream=True) as r:
|
||||||
@@ -58,6 +59,7 @@ class SaveImageUrl:
|
|||||||
OUTPUT_NODE = True
|
OUTPUT_NODE = True
|
||||||
FUNCTION = "save_images"
|
FUNCTION = "save_images"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Save Image (URL)"
|
||||||
|
|
||||||
def save_images(self, images, url, data_format, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None):
|
def save_images(self, images, url, data_format, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None):
|
||||||
filename = os.path.basename(os.path.normpath(filename_prefix))
|
filename = os.path.basename(os.path.normpath(filename_prefix))
|
||||||
@@ -18,6 +18,7 @@ class CombineImageBatch:
|
|||||||
RETURN_NAMES = ("images",)
|
RETURN_NAMES = ("images",)
|
||||||
FUNCTION = "combine_images"
|
FUNCTION = "combine_images"
|
||||||
CATEGORY = "remote"
|
CATEGORY = "remote"
|
||||||
|
TITLE = "Combine images"
|
||||||
|
|
||||||
def combine_images(self,images_a,images_b):
|
def combine_images(self,images_a,images_b):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
from .control import QueueRemoteChainStart, QueueRemoteChainEnd, QueueRemote, FetchRemote
|
||||||
|
from .images import LoadImageUrl, SaveImageUrl
|
||||||
|
from .misc import CombineImageBatch
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {
|
||||||
|
"QueueRemoteChainStart": QueueRemoteChainStart,
|
||||||
|
"QueueRemoteChainEnd": QueueRemoteChainEnd,
|
||||||
|
"QueueRemote": QueueRemote,
|
||||||
|
"FetchRemote": FetchRemote,
|
||||||
|
"LoadImageUrl": LoadImageUrl,
|
||||||
|
"SaveImageUrl": SaveImageUrl,
|
||||||
|
"CombineImageBatch": CombineImageBatch,
|
||||||
|
}
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {k:v.TITLE for k,v in NODE_CLASS_MAPPINGS.items()}
|
||||||
Reference in New Issue
Block a user