diff --git a/.gitignore b/.gitignore index f7b76ec2b..b1e3be697 100644 --- a/.gitignore +++ b/.gitignore @@ -35,8 +35,6 @@ dist/ downloads/ eggs/ .eggs/ -lib/ -lib64/ parts/ sdist/ var/ diff --git a/MANIFEST.in b/MANIFEST.in index 17cab838e..cf3ff9585 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -recursive-include web * +recursive-include comfy/web * diff --git a/comfy/cmd/server.py b/comfy/cmd/server.py index 06a621591..ea133e6aa 100644 --- a/comfy/cmd/server.py +++ b/comfy/cmd/server.py @@ -105,7 +105,7 @@ class PromptServer(): self.app = web.Application(client_max_size=max_upload_size, handler_args={'max_field_size': 16380}, middlewares=middlewares) self.sockets = dict() - web_root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../web") + web_root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../web") if not os.path.exists(web_root_path): web_root_path = resource_filename('comfy', 'web/') self.web_root = web_root_path diff --git a/comfy/web b/comfy/web deleted file mode 120000 index ceab434e4..000000000 --- a/comfy/web +++ /dev/null @@ -1 +0,0 @@ -../web \ No newline at end of file diff --git a/web/extensions/core/clipspace.js b/comfy/web/extensions/core/clipspace.js similarity index 100% rename from web/extensions/core/clipspace.js rename to comfy/web/extensions/core/clipspace.js diff --git a/web/extensions/core/colorPalette.js b/comfy/web/extensions/core/colorPalette.js similarity index 100% rename from web/extensions/core/colorPalette.js rename to comfy/web/extensions/core/colorPalette.js diff --git a/web/extensions/core/contextMenuFilter.js b/comfy/web/extensions/core/contextMenuFilter.js similarity index 100% rename from web/extensions/core/contextMenuFilter.js rename to comfy/web/extensions/core/contextMenuFilter.js diff --git a/web/extensions/core/dynamicPrompts.js b/comfy/web/extensions/core/dynamicPrompts.js similarity index 100% rename from web/extensions/core/dynamicPrompts.js rename to comfy/web/extensions/core/dynamicPrompts.js diff --git a/web/extensions/core/editAttention.js b/comfy/web/extensions/core/editAttention.js similarity index 100% rename from web/extensions/core/editAttention.js rename to comfy/web/extensions/core/editAttention.js diff --git a/web/extensions/core/groupNode.js b/comfy/web/extensions/core/groupNode.js similarity index 100% rename from web/extensions/core/groupNode.js rename to comfy/web/extensions/core/groupNode.js diff --git a/web/extensions/core/groupOptions.js b/comfy/web/extensions/core/groupOptions.js similarity index 100% rename from web/extensions/core/groupOptions.js rename to comfy/web/extensions/core/groupOptions.js diff --git a/web/extensions/core/invertMenuScrolling.js b/comfy/web/extensions/core/invertMenuScrolling.js similarity index 100% rename from web/extensions/core/invertMenuScrolling.js rename to comfy/web/extensions/core/invertMenuScrolling.js diff --git a/web/extensions/core/keybinds.js b/comfy/web/extensions/core/keybinds.js similarity index 100% rename from web/extensions/core/keybinds.js rename to comfy/web/extensions/core/keybinds.js diff --git a/web/extensions/core/linkRenderMode.js b/comfy/web/extensions/core/linkRenderMode.js similarity index 100% rename from web/extensions/core/linkRenderMode.js rename to comfy/web/extensions/core/linkRenderMode.js diff --git a/web/extensions/core/maskeditor.js b/comfy/web/extensions/core/maskeditor.js similarity index 100% rename from web/extensions/core/maskeditor.js rename to comfy/web/extensions/core/maskeditor.js diff --git a/web/extensions/core/nodeTemplates.js b/comfy/web/extensions/core/nodeTemplates.js similarity index 100% rename from web/extensions/core/nodeTemplates.js rename to comfy/web/extensions/core/nodeTemplates.js diff --git a/web/extensions/core/noteNode.js b/comfy/web/extensions/core/noteNode.js similarity index 100% rename from web/extensions/core/noteNode.js rename to comfy/web/extensions/core/noteNode.js diff --git a/web/extensions/core/rerouteNode.js b/comfy/web/extensions/core/rerouteNode.js similarity index 100% rename from web/extensions/core/rerouteNode.js rename to comfy/web/extensions/core/rerouteNode.js diff --git a/web/extensions/core/saveImageExtraOutput.js b/comfy/web/extensions/core/saveImageExtraOutput.js similarity index 100% rename from web/extensions/core/saveImageExtraOutput.js rename to comfy/web/extensions/core/saveImageExtraOutput.js diff --git a/web/extensions/core/slotDefaults.js b/comfy/web/extensions/core/slotDefaults.js similarity index 100% rename from web/extensions/core/slotDefaults.js rename to comfy/web/extensions/core/slotDefaults.js diff --git a/web/extensions/core/snapToGrid.js b/comfy/web/extensions/core/snapToGrid.js similarity index 100% rename from web/extensions/core/snapToGrid.js rename to comfy/web/extensions/core/snapToGrid.js diff --git a/web/extensions/core/undoRedo.js b/comfy/web/extensions/core/undoRedo.js similarity index 100% rename from web/extensions/core/undoRedo.js rename to comfy/web/extensions/core/undoRedo.js diff --git a/web/extensions/core/uploadImage.js b/comfy/web/extensions/core/uploadImage.js similarity index 100% rename from web/extensions/core/uploadImage.js rename to comfy/web/extensions/core/uploadImage.js diff --git a/web/extensions/core/widgetInputs.js b/comfy/web/extensions/core/widgetInputs.js similarity index 100% rename from web/extensions/core/widgetInputs.js rename to comfy/web/extensions/core/widgetInputs.js diff --git a/web/extensions/logging.js.example b/comfy/web/extensions/logging.js.example similarity index 100% rename from web/extensions/logging.js.example rename to comfy/web/extensions/logging.js.example diff --git a/web/index.html b/comfy/web/index.html similarity index 100% rename from web/index.html rename to comfy/web/index.html diff --git a/web/jsconfig.json b/comfy/web/jsconfig.json similarity index 100% rename from web/jsconfig.json rename to comfy/web/jsconfig.json diff --git a/web/lib/litegraph.core.js b/comfy/web/lib/litegraph.core.js similarity index 100% rename from web/lib/litegraph.core.js rename to comfy/web/lib/litegraph.core.js diff --git a/web/lib/litegraph.css b/comfy/web/lib/litegraph.css similarity index 100% rename from web/lib/litegraph.css rename to comfy/web/lib/litegraph.css diff --git a/web/lib/litegraph.extensions.js b/comfy/web/lib/litegraph.extensions.js similarity index 100% rename from web/lib/litegraph.extensions.js rename to comfy/web/lib/litegraph.extensions.js diff --git a/web/scripts/api.js b/comfy/web/scripts/api.js similarity index 100% rename from web/scripts/api.js rename to comfy/web/scripts/api.js diff --git a/web/scripts/app.js b/comfy/web/scripts/app.js similarity index 100% rename from web/scripts/app.js rename to comfy/web/scripts/app.js diff --git a/web/scripts/defaultGraph.js b/comfy/web/scripts/defaultGraph.js similarity index 100% rename from web/scripts/defaultGraph.js rename to comfy/web/scripts/defaultGraph.js diff --git a/web/scripts/domWidget.js b/comfy/web/scripts/domWidget.js similarity index 100% rename from web/scripts/domWidget.js rename to comfy/web/scripts/domWidget.js diff --git a/web/scripts/logging.js b/comfy/web/scripts/logging.js similarity index 100% rename from web/scripts/logging.js rename to comfy/web/scripts/logging.js diff --git a/web/scripts/pnginfo.js b/comfy/web/scripts/pnginfo.js similarity index 100% rename from web/scripts/pnginfo.js rename to comfy/web/scripts/pnginfo.js diff --git a/web/scripts/ui.js b/comfy/web/scripts/ui.js similarity index 100% rename from web/scripts/ui.js rename to comfy/web/scripts/ui.js diff --git a/web/scripts/ui/imagePreview.js b/comfy/web/scripts/ui/imagePreview.js similarity index 100% rename from web/scripts/ui/imagePreview.js rename to comfy/web/scripts/ui/imagePreview.js diff --git a/web/scripts/utils.js b/comfy/web/scripts/utils.js similarity index 100% rename from web/scripts/utils.js rename to comfy/web/scripts/utils.js diff --git a/web/scripts/widgets.js b/comfy/web/scripts/widgets.js similarity index 100% rename from web/scripts/widgets.js rename to comfy/web/scripts/widgets.js diff --git a/web/style.css b/comfy/web/style.css similarity index 100% rename from web/style.css rename to comfy/web/style.css diff --git a/web/types/comfy.d.ts b/comfy/web/types/comfy.d.ts similarity index 100% rename from web/types/comfy.d.ts rename to comfy/web/types/comfy.d.ts diff --git a/web/types/litegraph.d.ts b/comfy/web/types/litegraph.d.ts similarity index 100% rename from web/types/litegraph.d.ts rename to comfy/web/types/litegraph.d.ts diff --git a/web/user.css b/comfy/web/user.css similarity index 100% rename from web/user.css rename to comfy/web/user.css diff --git a/comfy_extras/chainner_models/architecture/OmniSR/__init__.py b/comfy_extras/chainner_models/architecture/OmniSR/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_extras/chainner_models/architecture/face/__init__.py b/comfy_extras/chainner_models/architecture/face/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_extras/chainner_models/architecture/mat/__init__.py b/comfy_extras/chainner_models/architecture/mat/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_extras/chainner_models/architecture/timm/__init__.py b/comfy_extras/chainner_models/architecture/timm/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_extras/nodes/nodes_upscale_model.py b/comfy_extras/nodes/nodes_upscale_model.py index 5678d428b..31bd420a3 100644 --- a/comfy_extras/nodes/nodes_upscale_model.py +++ b/comfy_extras/nodes/nodes_upscale_model.py @@ -8,8 +8,9 @@ from comfy.cmd import folder_paths class UpscaleModelLoader: @classmethod def INPUT_TYPES(s): - return {"required": { "model_name": (folder_paths.get_filename_list("upscale_models"),), + return {"required": {"model_name": (folder_paths.get_filename_list("upscale_models"),), }} + RETURN_TYPES = ("UPSCALE_MODEL",) FUNCTION = "load_model" @@ -19,17 +20,18 @@ class UpscaleModelLoader: model_path = folder_paths.get_full_path("upscale_models", model_name) sd = utils.load_torch_file(model_path, safe_load=True) if "module.layers.0.residual_group.blocks.0.norm1.weight" in sd: - sd = utils.state_dict_prefix_replace(sd, {"module.":""}) + sd = utils.state_dict_prefix_replace(sd, {"module.": ""}) out = model_loading.load_state_dict(sd).eval() - return (out, ) + return (out,) class ImageUpscaleWithModel: @classmethod def INPUT_TYPES(s): - return {"required": { "upscale_model": ("UPSCALE_MODEL",), - "image": ("IMAGE",), - }} + return {"required": {"upscale_model": ("UPSCALE_MODEL",), + "image": ("IMAGE",), + }} + RETURN_TYPES = ("IMAGE",) FUNCTION = "upscale" @@ -38,7 +40,7 @@ class ImageUpscaleWithModel: def upscale(self, upscale_model, image): device = model_management.get_torch_device() upscale_model.to(device) - in_img = image.movedim(-1,-3).to(device) + in_img = image.movedim(-1, -3).to(device) free_memory = model_management.get_free_memory(device) tile = 512 @@ -47,9 +49,11 @@ class ImageUpscaleWithModel: oom = True while oom: try: - steps = in_img.shape[0] * utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, tile_y=tile, overlap=overlap) + steps = in_img.shape[0] * utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, + tile_y=tile, overlap=overlap) pbar = utils.ProgressBar(steps) - s = utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar) + s = utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, + upscale_amount=upscale_model.scale, pbar=pbar) oom = False except model_management.OOM_EXCEPTION as e: tile //= 2 @@ -57,9 +61,10 @@ class ImageUpscaleWithModel: raise e upscale_model.cpu() - s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0) + s = torch.clamp(s.movedim(-3, -1), min=0, max=1.0) return (s,) + NODE_CLASS_MAPPINGS = { "UpscaleModelLoader": UpscaleModelLoader, "ImageUpscaleWithModel": ImageUpscaleWithModel diff --git a/setup.py b/setup.py index ca79d0db8..9894d35b1 100644 --- a/setup.py +++ b/setup.py @@ -150,7 +150,7 @@ def dependencies() -> List[str]: package_data = ['sd1_tokenizer/*', '**/*.json', '**/*.yaml'] if not is_editable: - package_data.append('web/**/*') + package_data.append('comfy/web/**/*') setup( name=package_name, description="",