From 56098f370ca6e180cf1aeed5a0658da0a5694a16 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:00:22 +1000 Subject: [PATCH 1/5] feat(nodes): add `RealESRGAN_x2plus.pth`, update upscale nodes - add `RealESRGAN_x2plus.pth` model to installer - add `RealESRGAN_x2plus.pth` to `realesrgan` node - rename `RealESRGAN` to `ESRGAN` in nodes - make `scale_factor` optional in `img_scale` node --- invokeai/app/invocations/image.py | 4 +- invokeai/app/invocations/upscale.py | 37 +++++++++---------- .../backend/install/invokeai_configure.py | 7 +++- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/invokeai/app/invocations/image.py b/invokeai/app/invocations/image.py index 2612a58ba7..137af2bb3f 100644 --- a/invokeai/app/invocations/image.py +++ b/invokeai/app/invocations/image.py @@ -437,8 +437,8 @@ class ImageScaleInvocation(BaseInvocation, PILInvocationConfig): type: Literal["img_scale"] = "img_scale" # Inputs - image: Optional[ImageField] = Field(default=None, description="The image to scale") - scale_factor: float = Field(gt=0, description="The factor by which to scale the image") + image: Optional[ImageField] = Field(default=None, description="The image to scale") + scale_factor: Optional[float] = Field(default=2.0, gt=0, description="The factor by which to scale the image") resample_mode: PIL_RESAMPLING_MODES = Field(default="bicubic", description="The resampling mode") # fmt: on diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index 9fa208fb31..90d850b9f1 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -1,6 +1,6 @@ # Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654) & the InvokeAI Team -from pathlib import Path, PosixPath -from typing import Literal, Union, cast +from pathlib import Path +from typing import Literal, Union import cv2 as cv import numpy as np @@ -16,19 +16,20 @@ from .image import ImageOutput # TODO: Populate this from disk? # TODO: Use model manager to load? -REALESRGAN_MODELS = Literal[ +ESRGAN_MODELS = Literal[ "RealESRGAN_x4plus.pth", "RealESRGAN_x4plus_anime_6B.pth", "ESRGAN_SRx4_DF2KOST_official-ff704c30.pth", + "RealESRGAN_x2plus.pth", ] -class RealESRGANInvocation(BaseInvocation): +class ESRGANInvocation(BaseInvocation): """Upscales an image using RealESRGAN.""" - type: Literal["realesrgan"] = "realesrgan" + type: Literal["esrgan"] = "esrgan" image: Union[ImageField, None] = Field(default=None, description="The input image") - model_name: REALESRGAN_MODELS = Field( + model_name: ESRGAN_MODELS = Field( default="RealESRGAN_x4plus.pth", description="The Real-ESRGAN model to use" ) @@ -65,19 +66,17 @@ class RealESRGANInvocation(BaseInvocation): scale=4, ) netscale = 4 - # TODO: add x2 models handling? - # elif self.model_name in ["RealESRGAN_x2plus"]: - # # x2 RRDBNet model - # model = RRDBNet( - # num_in_ch=3, - # num_out_ch=3, - # num_feat=64, - # num_block=23, - # num_grow_ch=32, - # scale=2, - # ) - # model_path = Path() - # netscale = 2 + elif self.model_name in ["RealESRGAN_x2plus.pth"]: + # x2 RRDBNet model + rrdbnet_model = RRDBNet( + num_in_ch=3, + num_out_ch=3, + num_feat=64, + num_block=23, + num_grow_ch=32, + scale=2, + ) + netscale = 2 else: msg = f"Invalid RealESRGAN model: {self.model_name}" context.services.logger.error(msg) diff --git a/invokeai/backend/install/invokeai_configure.py b/invokeai/backend/install/invokeai_configure.py index 91f379a573..40daac65e4 100755 --- a/invokeai/backend/install/invokeai_configure.py +++ b/invokeai/backend/install/invokeai_configure.py @@ -223,7 +223,7 @@ def download_conversion_models(): # --------------------------------------------- def download_realesrgan(): - logger.info("Installing RealESRGAN models...") + logger.info("Installing ESRGAN Upscaling models...") URLs = [ dict( url = "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth", @@ -240,6 +240,11 @@ def download_realesrgan(): dest= "core/upscaling/realesrgan/ESRGAN_SRx4_DF2KOST_official-ff704c30.pth", description = "ESRGAN_SRx4_DF2KOST_official.pth", ), + dict( + url= "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth", + dest= "core/upscaling/realesrgan/RealESRGAN_x2plus.pth", + description = "RealESRGAN_x2plus.pth", + ), ] for model in URLs: download_with_progress_bar(model['url'], config.models_path / model['dest'], model['description']) From be659364c2a942066fda4d1adb1f89849fc57ee5 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:08:53 +1000 Subject: [PATCH 2/5] chore(ui): regen types --- .../frontend/web/src/services/api/schema.d.ts | 608 ++---------------- 1 file changed, 41 insertions(+), 567 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/schema.d.ts b/invokeai/frontend/web/src/services/api/schema.d.ts index b86c233c51..e9ff24a2e1 100644 --- a/invokeai/frontend/web/src/services/api/schema.d.ts +++ b/invokeai/frontend/web/src/services/api/schema.d.ts @@ -1105,6 +1105,41 @@ export type components = { */ combinatorial?: boolean; }; + /** + * ESRGANInvocation + * @description Upscales an image using RealESRGAN. + */ + ESRGANInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default esrgan + * @enum {string} + */ + type?: "esrgan"; + /** + * Image + * @description The input image + */ + image?: components["schemas"]["ImageField"]; + /** + * Model Name + * @description The Real-ESRGAN model to use + * @default RealESRGAN_x4plus.pth + * @enum {string} + */ + model_name?: "RealESRGAN_x4plus.pth" | "RealESRGAN_x4plus_anime_6B.pth" | "ESRGAN_SRx4_DF2KOST_official-ff704c30.pth" | "RealESRGAN_x2plus.pth"; + }; /** Edge */ Edge: { /** @@ -1219,7 +1254,7 @@ export type components = { * @description The nodes in this graph */ nodes?: { - [key: string]: (components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["RealESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]) | undefined; + [key: string]: (components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]) | undefined; }; /** * Edges @@ -2011,9 +2046,10 @@ export type components = { image?: components["schemas"]["ImageField"]; /** * Scale Factor - * @description The factor by which to scale the image + * @description The factor by which to scale the image + * @default 2 */ - scale_factor: number; + scale_factor?: number; /** * Resample Mode * @description The resampling mode @@ -3988,41 +4024,6 @@ export type components = { */ step?: number; }; - /** - * RealESRGANInvocation - * @description Upscales an image using RealESRGAN. - */ - RealESRGANInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default realesrgan - * @enum {string} - */ - type?: "realesrgan"; - /** - * Image - * @description The input image - */ - image?: components["schemas"]["ImageField"]; - /** - * Model Name - * @description The Real-ESRGAN model to use - * @default RealESRGAN_x4plus.pth - * @enum {string} - */ - model_name?: "RealESRGAN_x4plus.pth" | "RealESRGAN_x4plus_anime_6B.pth" | "ESRGAN_SRx4_DF2KOST_official-ff704c30.pth"; - }; /** * ResizeLatentsInvocation * @description Resizes latents to explicit width/height (in pixels). Provided dimensions are floor-divided by 8. @@ -4086,533 +4087,6 @@ export type components = { * @enum {string} */ ResourceOrigin: "internal" | "external"; - /** - * SDXLCompelPromptInvocation - * @description Parse prompt using compel package to conditioning. - */ - SDXLCompelPromptInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_compel_prompt - * @enum {string} - */ - type?: "sdxl_compel_prompt"; - /** - * Prompt - * @description Prompt - * @default - */ - prompt?: string; - /** - * Style - * @description Style prompt - * @default - */ - style?: string; - /** - * Original Width - * @default 1024 - */ - original_width?: number; - /** - * Original Height - * @default 1024 - */ - original_height?: number; - /** - * Crop Top - * @default 0 - */ - crop_top?: number; - /** - * Crop Left - * @default 0 - */ - crop_left?: number; - /** - * Target Width - * @default 1024 - */ - target_width?: number; - /** - * Target Height - * @default 1024 - */ - target_height?: number; - /** - * Clip1 - * @description Clip to use - */ - clip1?: components["schemas"]["ClipField"]; - /** - * Clip2 - * @description Clip to use - */ - clip2?: components["schemas"]["ClipField"]; - }; - /** - * SDXLLatentsToLatentsInvocation - * @description Generates latents from conditionings. - */ - SDXLLatentsToLatentsInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default l2l_sdxl - * @enum {string} - */ - type?: "l2l_sdxl"; - /** - * Positive Conditioning - * @description Positive conditioning for generation - */ - positive_conditioning?: components["schemas"]["ConditioningField"]; - /** - * Negative Conditioning - * @description Negative conditioning for generation - */ - negative_conditioning?: components["schemas"]["ConditioningField"]; - /** - * Noise - * @description The noise to use - */ - noise?: components["schemas"]["LatentsField"]; - /** - * Steps - * @description The number of steps to use to generate the image - * @default 10 - */ - steps?: number; - /** - * Cfg Scale - * @description The Classifier-Free Guidance, higher values may result in a result closer to the prompt - * @default 7.5 - */ - cfg_scale?: number | (number)[]; - /** - * Scheduler - * @description The scheduler to use - * @default euler - * @enum {string} - */ - scheduler?: "ddim" | "ddpm" | "deis" | "lms" | "lms_k" | "pndm" | "heun" | "heun_k" | "euler" | "euler_k" | "euler_a" | "kdpm_2" | "kdpm_2_a" | "dpmpp_2s" | "dpmpp_2s_k" | "dpmpp_2m" | "dpmpp_2m_k" | "dpmpp_2m_sde" | "dpmpp_2m_sde_k" | "dpmpp_sde" | "dpmpp_sde_k" | "unipc"; - /** - * Unet - * @description UNet submodel - */ - unet?: components["schemas"]["UNetField"]; - /** - * Latents - * @description Initial latents - */ - latents?: components["schemas"]["LatentsField"]; - /** - * Denoising Start - * @default 0 - */ - denoising_start?: number; - /** - * Denoising End - * @default 1 - */ - denoising_end?: number; - }; - /** - * SDXLModelLoaderInvocation - * @description Loads an sdxl base model, outputting its submodels. - */ - SDXLModelLoaderInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_model_loader - * @enum {string} - */ - type?: "sdxl_model_loader"; - /** - * Model - * @description The model to load - */ - model: components["schemas"]["MainModelField"]; - }; - /** - * SDXLModelLoaderOutput - * @description SDXL base model loader output - */ - SDXLModelLoaderOutput: { - /** - * Type - * @default sdxl_model_loader_output - * @enum {string} - */ - type?: "sdxl_model_loader_output"; - /** - * Unet - * @description UNet submodel - */ - unet?: components["schemas"]["UNetField"]; - /** - * Clip - * @description Tokenizer and text_encoder submodels - */ - clip?: components["schemas"]["ClipField"]; - /** - * Clip2 - * @description Tokenizer and text_encoder submodels - */ - clip2?: components["schemas"]["ClipField"]; - /** - * Vae - * @description Vae submodel - */ - vae?: components["schemas"]["VaeField"]; - }; - /** - * SDXLRawPromptInvocation - * @description Parse prompt using compel package to conditioning. - */ - SDXLRawPromptInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_raw_prompt - * @enum {string} - */ - type?: "sdxl_raw_prompt"; - /** - * Prompt - * @description Prompt - * @default - */ - prompt?: string; - /** - * Style - * @description Style prompt - * @default - */ - style?: string; - /** - * Original Width - * @default 1024 - */ - original_width?: number; - /** - * Original Height - * @default 1024 - */ - original_height?: number; - /** - * Crop Top - * @default 0 - */ - crop_top?: number; - /** - * Crop Left - * @default 0 - */ - crop_left?: number; - /** - * Target Width - * @default 1024 - */ - target_width?: number; - /** - * Target Height - * @default 1024 - */ - target_height?: number; - /** - * Clip1 - * @description Clip to use - */ - clip1?: components["schemas"]["ClipField"]; - /** - * Clip2 - * @description Clip to use - */ - clip2?: components["schemas"]["ClipField"]; - }; - /** - * SDXLRefinerCompelPromptInvocation - * @description Parse prompt using compel package to conditioning. - */ - SDXLRefinerCompelPromptInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_refiner_compel_prompt - * @enum {string} - */ - type?: "sdxl_refiner_compel_prompt"; - /** - * Style - * @description Style prompt - * @default - */ - style?: string; - /** - * Original Width - * @default 1024 - */ - original_width?: number; - /** - * Original Height - * @default 1024 - */ - original_height?: number; - /** - * Crop Top - * @default 0 - */ - crop_top?: number; - /** - * Crop Left - * @default 0 - */ - crop_left?: number; - /** - * Aesthetic Score - * @default 6 - */ - aesthetic_score?: number; - /** - * Clip2 - * @description Clip to use - */ - clip2?: components["schemas"]["ClipField"]; - }; - /** - * SDXLRefinerModelLoaderInvocation - * @description Loads an sdxl refiner model, outputting its submodels. - */ - SDXLRefinerModelLoaderInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_refiner_model_loader - * @enum {string} - */ - type?: "sdxl_refiner_model_loader"; - /** - * Model - * @description The model to load - */ - model: components["schemas"]["MainModelField"]; - }; - /** - * SDXLRefinerModelLoaderOutput - * @description SDXL refiner model loader output - */ - SDXLRefinerModelLoaderOutput: { - /** - * Type - * @default sdxl_refiner_model_loader_output - * @enum {string} - */ - type?: "sdxl_refiner_model_loader_output"; - /** - * Unet - * @description UNet submodel - */ - unet?: components["schemas"]["UNetField"]; - /** - * Clip2 - * @description Tokenizer and text_encoder submodels - */ - clip2?: components["schemas"]["ClipField"]; - /** - * Vae - * @description Vae submodel - */ - vae?: components["schemas"]["VaeField"]; - }; - /** - * SDXLRefinerRawPromptInvocation - * @description Parse prompt using compel package to conditioning. - */ - SDXLRefinerRawPromptInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default sdxl_refiner_raw_prompt - * @enum {string} - */ - type?: "sdxl_refiner_raw_prompt"; - /** - * Style - * @description Style prompt - * @default - */ - style?: string; - /** - * Original Width - * @default 1024 - */ - original_width?: number; - /** - * Original Height - * @default 1024 - */ - original_height?: number; - /** - * Crop Top - * @default 0 - */ - crop_top?: number; - /** - * Crop Left - * @default 0 - */ - crop_left?: number; - /** - * Aesthetic Score - * @default 6 - */ - aesthetic_score?: number; - /** - * Clip2 - * @description Clip to use - */ - clip2?: components["schemas"]["ClipField"]; - }; - /** - * SDXLTextToLatentsInvocation - * @description Generates latents from conditionings. - */ - SDXLTextToLatentsInvocation: { - /** - * Id - * @description The id of this node. Must be unique among all nodes. - */ - id: string; - /** - * Is Intermediate - * @description Whether or not this node is an intermediate node. - * @default false - */ - is_intermediate?: boolean; - /** - * Type - * @default t2l_sdxl - * @enum {string} - */ - type?: "t2l_sdxl"; - /** - * Positive Conditioning - * @description Positive conditioning for generation - */ - positive_conditioning?: components["schemas"]["ConditioningField"]; - /** - * Negative Conditioning - * @description Negative conditioning for generation - */ - negative_conditioning?: components["schemas"]["ConditioningField"]; - /** - * Noise - * @description The noise to use - */ - noise?: components["schemas"]["LatentsField"]; - /** - * Steps - * @description The number of steps to use to generate the image - * @default 10 - */ - steps?: number; - /** - * Cfg Scale - * @description The Classifier-Free Guidance, higher values may result in a result closer to the prompt - * @default 7.5 - */ - cfg_scale?: number | (number)[]; - /** - * Scheduler - * @description The scheduler to use - * @default euler - * @enum {string} - */ - scheduler?: "ddim" | "ddpm" | "deis" | "lms" | "lms_k" | "pndm" | "heun" | "heun_k" | "euler" | "euler_k" | "euler_a" | "kdpm_2" | "kdpm_2_a" | "dpmpp_2s" | "dpmpp_2s_k" | "dpmpp_2m" | "dpmpp_2m_k" | "dpmpp_2m_sde" | "dpmpp_2m_sde_k" | "dpmpp_sde" | "dpmpp_sde_k" | "unipc"; - /** - * Unet - * @description UNet submodel - */ - unet?: components["schemas"]["UNetField"]; - /** - * Denoising End - * @default 1 - */ - denoising_end?: number; - }; /** * ScaleLatentsInvocation * @description Scales latents by a given factor. @@ -5379,7 +4853,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["RealESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; + "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; }; }; responses: { @@ -5416,7 +4890,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["RealESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; + "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; }; }; responses: { From afa84a149ce888a5e1b2f5d212f0205c27a427d8 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:08:59 +1000 Subject: [PATCH 3/5] feat(ui): restore ad-hoc upscaling - remove face restoration entirely - add dropdown for ESRGAN model select - add ad-hoc upscaling graph and workflow --- invokeai/frontend/web/src/app/constants.ts | 7 - .../middleware/listenerMiddleware/index.ts | 3 + .../listeners/sessionCreated.ts | 4 +- .../listeners/upscaleRequested.ts | 37 +++ .../IAIMantineSelectItemWithTooltip.tsx | 2 +- .../CurrentImage/CurrentImageButtons.tsx | 220 ++---------------- .../graphBuilders/buildAdHocUpscaleGraph.ts | 32 +++ .../nodes/util/graphBuilders/constants.ts | 3 + .../FaceRestore/CodeformerFidelity.tsx | 34 --- .../FaceRestore/FaceRestoreSettings.tsx | 25 -- .../FaceRestore/FaceRestoreStrength.tsx | 34 --- .../FaceRestore/FaceRestoreToggle.tsx | 28 --- .../FaceRestore/FaceRestoreType.tsx | 30 --- .../Parameters/Hires/ParamHiresCollapse.tsx | 43 ---- .../Parameters/Hires/ParamHiresHeight.tsx | 3 - .../Parameters/Hires/ParamHiresSteps.tsx | 3 - .../Parameters/Hires/ParamHiresStrength.tsx | 51 ---- .../Parameters/Hires/ParamHiresToggle.tsx | 30 --- .../Parameters/Hires/ParamHiresWidth.tsx | 3 - .../Upscale/ParamRealESRGANModel.tsx | 58 +++++ .../Upscale/ParamUpscaleSettings.tsx | 62 +++++ .../Upscale/UpscaleDenoisingStrength.tsx | 36 --- .../Parameters/Upscale/UpscaleScale.tsx | 35 --- .../Parameters/Upscale/UpscaleSettings.tsx | 19 -- .../Parameters/Upscale/UpscaleStrength.tsx | 33 --- .../Parameters/Upscale/UpscaleToggle.tsx | 26 --- .../parameters/store/postprocessingSlice.ts | 85 +------ .../TextToImage/TextToImageTabParameters.tsx | 2 - .../frontend/web/src/services/api/types.d.ts | 9 + 29 files changed, 229 insertions(+), 728 deletions(-) create mode 100644 invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts create mode 100644 invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/CodeformerFidelity.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreSettings.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreStrength.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreToggle.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreType.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresCollapse.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresHeight.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresSteps.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresStrength.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresToggle.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresWidth.tsx create mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamRealESRGANModel.tsx create mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamUpscaleSettings.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleDenoisingStrength.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleScale.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleSettings.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleStrength.tsx delete mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleToggle.tsx diff --git a/invokeai/frontend/web/src/app/constants.ts b/invokeai/frontend/web/src/app/constants.ts index 440d9330d6..c52e3bd48f 100644 --- a/invokeai/frontend/web/src/app/constants.ts +++ b/invokeai/frontend/web/src/app/constants.ts @@ -59,15 +59,8 @@ export const SCHEDULER_LABEL_MAP: Record = { export type Scheduler = (typeof SCHEDULER_NAMES)[number]; -// Valid upscaling levels -export const UPSCALING_LEVELS: Array<{ label: string; value: string }> = [ - { label: '2x', value: '2' }, - { label: '4x', value: '4' }, -]; export const NUMPY_RAND_MIN = 0; export const NUMPY_RAND_MAX = 2147483647; -export const FACETOOL_TYPES = ['gfpgan', 'codeformer'] as const; - export const NODE_MIN_WIDTH = 250; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts index 94044d3cc5..35bfde2bff 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts @@ -90,6 +90,7 @@ import { addUserInvokedNodesListener } from './listeners/userInvokedNodes'; import { addUserInvokedTextToImageListener } from './listeners/userInvokedTextToImage'; import { addModelLoadStartedEventListener } from './listeners/socketio/socketModelLoadStarted'; import { addModelLoadCompletedEventListener } from './listeners/socketio/socketModelLoadCompleted'; +import { addUpscaleRequestedListener } from './listeners/upscaleRequested'; export const listenerMiddleware = createListenerMiddleware(); @@ -228,3 +229,5 @@ addModelSelectedListener(); addAppStartedListener(); addModelsLoadedListener(); addAppConfigReceivedListener(); + +addUpscaleRequestedListener(); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/sessionCreated.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/sessionCreated.ts index a55bd07c4d..9ae7105378 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/sessionCreated.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/sessionCreated.ts @@ -1,7 +1,7 @@ import { log } from 'app/logging/useLogger'; -import { startAppListening } from '..'; -import { sessionCreated } from 'services/api/thunks/session'; import { serializeError } from 'serialize-error'; +import { sessionCreated } from 'services/api/thunks/session'; +import { startAppListening } from '..'; const moduleLog = log.child({ namespace: 'session' }); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts new file mode 100644 index 0000000000..4b8ac59b88 --- /dev/null +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts @@ -0,0 +1,37 @@ +import { createAction } from '@reduxjs/toolkit'; +import { log } from 'app/logging/useLogger'; +import { buildAdHocUpscaleGraph } from 'features/nodes/util/graphBuilders/buildAdHocUpscaleGraph'; +import { sessionReadyToInvoke } from 'features/system/store/actions'; +import { sessionCreated } from 'services/api/thunks/session'; +import { startAppListening } from '..'; + +const moduleLog = log.child({ namespace: 'upscale' }); + +export const upscaleRequested = createAction<{ image_name: string }>( + `upscale/upscaleRequested` +); + +export const addUpscaleRequestedListener = () => { + startAppListening({ + actionCreator: upscaleRequested, + effect: async ( + action, + { dispatch, getState, take, unsubscribe, subscribe } + ) => { + const { image_name } = action.payload; + const { esrganModelName } = getState().postprocessing; + + const graph = buildAdHocUpscaleGraph({ + image_name, + esrganModelName, + }); + + // Create a session to run the graph & wait til it's ready to invoke + dispatch(sessionCreated({ graph })); + + await take(sessionCreated.fulfilled.match); + + dispatch(sessionReadyToInvoke()); + }, + }); +}; diff --git a/invokeai/frontend/web/src/common/components/IAIMantineSelectItemWithTooltip.tsx b/invokeai/frontend/web/src/common/components/IAIMantineSelectItemWithTooltip.tsx index 65ba4020c8..6b56bdf9e9 100644 --- a/invokeai/frontend/web/src/common/components/IAIMantineSelectItemWithTooltip.tsx +++ b/invokeai/frontend/web/src/common/components/IAIMantineSelectItemWithTooltip.tsx @@ -11,7 +11,7 @@ interface ItemProps extends React.ComponentPropsWithoutRef<'div'> { const IAIMantineSelectItemWithTooltip = forwardRef( ({ label, tooltip, description, disabled, ...others }: ItemProps, ref) => ( - + {label} diff --git a/invokeai/frontend/web/src/features/gallery/components/CurrentImage/CurrentImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/CurrentImage/CurrentImageButtons.tsx index c0c82d5456..0cf3671db0 100644 --- a/invokeai/frontend/web/src/features/gallery/components/CurrentImage/CurrentImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/CurrentImage/CurrentImageButtons.tsx @@ -5,34 +5,26 @@ import { ButtonGroup, Flex, FlexProps, - Link, Menu, MenuButton, - MenuItem, MenuList, } from '@chakra-ui/react'; // import { runESRGAN, runFacetool } from 'app/socketio/actions'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAIButton from 'common/components/IAIButton'; import IAIIconButton from 'common/components/IAIIconButton'; -import IAIPopover from 'common/components/IAIPopover'; import { skipToken } from '@reduxjs/toolkit/dist/query'; import { useAppToaster } from 'app/components/Toaster'; +import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested'; import { stateSelector } from 'app/store/store'; -import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; -import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; import { DeleteImageButton } from 'features/imageDeletion/components/DeleteImageButton'; import { imageToDeleteSelected } from 'features/imageDeletion/store/imageDeletionSlice'; -import FaceRestoreSettings from 'features/parameters/components/Parameters/FaceRestore/FaceRestoreSettings'; -import UpscaleSettings from 'features/parameters/components/Parameters/Upscale/UpscaleSettings'; +import ParamUpscalePopover from 'features/parameters/components/Parameters/Upscale/ParamUpscaleSettings'; import { useRecallParameters } from 'features/parameters/hooks/useRecallParameters'; import { initialImageSelected } from 'features/parameters/store/actions'; import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus'; -import { useCopyImageToClipboard } from 'features/ui/hooks/useCopyImageToClipboard'; import { activeTabNameSelector } from 'features/ui/store/uiSelectors'; import { - setActiveTab, setShouldShowImageDetails, setShouldShowProgressInViewer, } from 'features/ui/store/uiSlice'; @@ -42,38 +34,25 @@ import { useTranslation } from 'react-i18next'; import { FaAsterisk, FaCode, - FaCopy, - FaDownload, - FaExpandArrowsAlt, - FaGrinStars, FaHourglassHalf, FaQuoteRight, FaSeedling, - FaShare, FaShareAlt, } from 'react-icons/fa'; import { useGetImageDTOQuery, useGetImageMetadataQuery, } from 'services/api/endpoints/images'; -import { useDebounce } from 'use-debounce'; -import { sentImageToCanvas, sentImageToImg2Img } from '../../store/actions'; import { menuListMotionProps } from 'theme/components/menu'; +import { useDebounce } from 'use-debounce'; +import { sentImageToImg2Img } from '../../store/actions'; import SingleSelectionMenuItems from '../ImageContextMenu/SingleSelectionMenuItems'; const currentImageButtonsSelector = createSelector( [stateSelector, activeTabNameSelector], - ({ gallery, system, postprocessing, ui }, activeTabName) => { - const { - isProcessing, - isConnected, - isGFPGANAvailable, - isESRGANAvailable, - shouldConfirmOnDelete, - progressImage, - } = system; - - const { upscalingLevel, facetoolStrength } = postprocessing; + ({ gallery, system, ui }, activeTabName) => { + const { isProcessing, isConnected, shouldConfirmOnDelete, progressImage } = + system; const { shouldShowImageDetails, @@ -88,10 +67,6 @@ const currentImageButtonsSelector = createSelector( shouldConfirmOnDelete, isProcessing, isConnected, - isGFPGANAvailable, - isESRGANAvailable, - upscalingLevel, - facetoolStrength, shouldDisableToolbarButtons: Boolean(progressImage) || !lastSelectedImage, shouldShowImageDetails, activeTabName, @@ -114,27 +89,17 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { const { isProcessing, isConnected, - isGFPGANAvailable, - isESRGANAvailable, - upscalingLevel, - facetoolStrength, shouldDisableToolbarButtons, shouldShowImageDetails, - activeTabName, lastSelectedImage, shouldShowProgressInViewer, } = useAppSelector(currentImageButtonsSelector); - const isCanvasEnabled = useFeatureStatus('unifiedCanvas').isFeatureEnabled; const isUpscalingEnabled = useFeatureStatus('upscaling').isFeatureEnabled; - const isFaceRestoreEnabled = useFeatureStatus('faceRestore').isFeatureEnabled; const toaster = useAppToaster(); const { t } = useTranslation(); - const { isClipboardAPIAvailable, copyImageToClipboard } = - useCopyImageToClipboard(); - const { recallBothPrompts, recallSeed, recallAllParameters } = useRecallParameters(); @@ -155,42 +120,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { const metadata = metadataData?.metadata; - const handleCopyImageLink = useCallback(() => { - const getImageUrl = () => { - if (!imageDTO) { - return; - } - - if (imageDTO.image_url.startsWith('http')) { - return imageDTO.image_url; - } - - return window.location.toString() + imageDTO.image_url; - }; - - const url = getImageUrl(); - - if (!url) { - toaster({ - title: t('toast.problemCopyingImageLink'), - status: 'error', - duration: 2500, - isClosable: true, - }); - - return; - } - - navigator.clipboard.writeText(url).then(() => { - toaster({ - title: t('toast.imageLinkCopied'), - status: 'success', - duration: 2500, - isClosable: true, - }); - }); - }, [toaster, t, imageDTO]); - const handleClickUseAllParameters = useCallback(() => { recallAllParameters(metadata); }, [metadata, recallAllParameters]); @@ -223,8 +152,11 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { useHotkeys('shift+i', handleSendToImageToImage, [imageDTO]); const handleClickUpscale = useCallback(() => { - // selectedImage && dispatch(runESRGAN(selectedImage)); - }, []); + if (!imageDTO) { + return; + } + dispatch(upscaleRequested({ image_name: imageDTO.image_name })); + }, [dispatch, imageDTO]); const handleDelete = useCallback(() => { if (!imageDTO) { @@ -242,53 +174,17 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { enabled: () => Boolean( isUpscalingEnabled && - isESRGANAvailable && !shouldDisableToolbarButtons && isConnected && - !isProcessing && - upscalingLevel + !isProcessing ), }, [ isUpscalingEnabled, imageDTO, - isESRGANAvailable, shouldDisableToolbarButtons, isConnected, isProcessing, - upscalingLevel, - ] - ); - - const handleClickFixFaces = useCallback(() => { - // selectedImage && dispatch(runFacetool(selectedImage)); - }, []); - - useHotkeys( - 'Shift+R', - () => { - handleClickFixFaces(); - }, - { - enabled: () => - Boolean( - isFaceRestoreEnabled && - isGFPGANAvailable && - !shouldDisableToolbarButtons && - isConnected && - !isProcessing && - facetoolStrength - ), - }, - - [ - isFaceRestoreEnabled, - imageDTO, - isGFPGANAvailable, - shouldDisableToolbarButtons, - isConnected, - isProcessing, - facetoolStrength, ] ); @@ -297,25 +193,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { [dispatch, shouldShowImageDetails] ); - const handleSendToCanvas = useCallback(() => { - if (!imageDTO) return; - dispatch(sentImageToCanvas()); - - dispatch(setInitialCanvasImage(imageDTO)); - dispatch(requestCanvasRescale()); - - if (activeTabName !== 'unifiedCanvas') { - dispatch(setActiveTab('unifiedCanvas')); - } - - toaster({ - title: t('toast.sentToUnifiedCanvas'), - status: 'success', - duration: 2500, - isClosable: true, - }); - }, [imageDTO, dispatch, activeTabName, toaster, t]); - useHotkeys( 'i', () => { @@ -337,13 +214,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { dispatch(setShouldShowProgressInViewer(!shouldShowProgressInViewer)); }, [dispatch, shouldShowProgressInViewer]); - const handleCopyImage = useCallback(() => { - if (!imageDTO) { - return; - } - copyImageToClipboard(imageDTO.image_url); - }, [copyImageToClipboard, imageDTO]); - return ( <> { /> - {(isUpscalingEnabled || isFaceRestoreEnabled) && ( + {isUpscalingEnabled && ( - {isFaceRestoreEnabled && ( - } - aria-label={t('parameters.restoreFaces')} - /> - } - > - - - - {t('parameters.restoreFaces')} - - - - )} - - {isUpscalingEnabled && ( - } - aria-label={t('parameters.upscale')} - /> - } - > - - - - {t('parameters.upscaleImage')} - - - - )} + {isUpscalingEnabled && } )} diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts new file mode 100644 index 0000000000..10e3ba5152 --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts @@ -0,0 +1,32 @@ +import { NonNullableGraph } from 'features/nodes/types/types'; +import { ESRGANModelName } from 'features/parameters/store/postprocessingSlice'; +import { Graph, ESRGANInvocation } from 'services/api/types'; +import { REALESRGAN as ESRGAN } from './constants'; + +type Arg = { + image_name: string; + esrganModelName: ESRGANModelName; +}; + +export const buildAdHocUpscaleGraph = ({ + image_name, + esrganModelName, +}: Arg): Graph => { + const realesrganNode: ESRGANInvocation = { + id: ESRGAN, + type: 'esrgan', + image: { image_name }, + model_name: esrganModelName, + is_intermediate: false, + }; + + const graph: NonNullableGraph = { + id: `adhoc-esrgan-graph`, + nodes: { + [ESRGAN]: realesrganNode, + }, + edges: [], + }; + + return graph; +}; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts index 92ce7715ba..e01fcf2c70 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts @@ -20,6 +20,9 @@ export const DYNAMIC_PROMPT = 'dynamic_prompt'; export const IMAGE_COLLECTION = 'image_collection'; export const IMAGE_COLLECTION_ITERATE = 'image_collection_iterate'; export const METADATA_ACCUMULATOR = 'metadata_accumulator'; +export const REALESRGAN = 'esrgan'; +export const DIVIDE = 'divide'; +export const SCALE = 'scale_image'; // friendly graph ids export const TEXT_TO_IMAGE_GRAPH = 'text_to_image_graph'; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/CodeformerFidelity.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/CodeformerFidelity.tsx deleted file mode 100644 index f154477932..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/CodeformerFidelity.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISlider from 'common/components/IAISlider'; -import { setCodeformerFidelity } from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function CodeformerFidelity() { - const isGFPGANAvailable = useAppSelector( - (state: RootState) => state.system.isGFPGANAvailable - ); - - const codeformerFidelity = useAppSelector( - (state: RootState) => state.postprocessing.codeformerFidelity - ); - - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - - return ( - dispatch(setCodeformerFidelity(v))} - handleReset={() => dispatch(setCodeformerFidelity(1))} - value={codeformerFidelity} - withReset - withSliderMarks - withInput - /> - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreSettings.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreSettings.tsx deleted file mode 100644 index f4d5ca07bc..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreSettings.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { VStack } from '@chakra-ui/react'; -import { useAppSelector } from 'app/store/storeHooks'; -import type { RootState } from 'app/store/store'; -import FaceRestoreType from './FaceRestoreType'; -import FaceRestoreStrength from './FaceRestoreStrength'; -import CodeformerFidelity from './CodeformerFidelity'; - -/** - * Displays face-fixing/GFPGAN options (strength). - */ -const FaceRestoreSettings = () => { - const facetoolType = useAppSelector( - (state: RootState) => state.postprocessing.facetoolType - ); - - return ( - - - - {facetoolType === 'codeformer' && } - - ); -}; - -export default FaceRestoreSettings; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreStrength.tsx deleted file mode 100644 index eeb5417c6e..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreStrength.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISlider from 'common/components/IAISlider'; -import { setFacetoolStrength } from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function FaceRestoreStrength() { - const isGFPGANAvailable = useAppSelector( - (state: RootState) => state.system.isGFPGANAvailable - ); - - const facetoolStrength = useAppSelector( - (state: RootState) => state.postprocessing.facetoolStrength - ); - - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - - return ( - dispatch(setFacetoolStrength(v))} - handleReset={() => dispatch(setFacetoolStrength(0.75))} - value={facetoolStrength} - withReset - withSliderMarks - withInput - /> - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreToggle.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreToggle.tsx deleted file mode 100644 index a314c0ad73..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreToggle.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISwitch from 'common/components/IAISwitch'; -import { setShouldRunFacetool } from 'features/parameters/store/postprocessingSlice'; -import { ChangeEvent } from 'react'; - -export default function FaceRestoreToggle() { - const isGFPGANAvailable = useAppSelector( - (state: RootState) => state.system.isGFPGANAvailable - ); - - const shouldRunFacetool = useAppSelector( - (state: RootState) => state.postprocessing.shouldRunFacetool - ); - - const dispatch = useAppDispatch(); - - const handleChangeShouldRunFacetool = (e: ChangeEvent) => - dispatch(setShouldRunFacetool(e.target.checked)); - - return ( - - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreType.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreType.tsx deleted file mode 100644 index 931d354878..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/FaceRestore/FaceRestoreType.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { FACETOOL_TYPES } from 'app/constants'; -import { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAIMantineSearchableSelect from 'common/components/IAIMantineSearchableSelect'; -import { - FacetoolType, - setFacetoolType, -} from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function FaceRestoreType() { - const facetoolType = useAppSelector( - (state: RootState) => state.postprocessing.facetoolType - ); - - const dispatch = useAppDispatch(); - const { t } = useTranslation(); - - const handleChangeFacetoolType = (v: string) => - dispatch(setFacetoolType(v as FacetoolType)); - - return ( - - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresCollapse.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresCollapse.tsx deleted file mode 100644 index fa8606d610..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresCollapse.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Flex } from '@chakra-ui/react'; -import { createSelector } from '@reduxjs/toolkit'; -import { stateSelector } from 'app/store/store'; -import { useAppSelector } from 'app/store/storeHooks'; -import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; -import IAICollapse from 'common/components/IAICollapse'; -import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus'; -import { memo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { ParamHiresStrength } from './ParamHiresStrength'; -import { ParamHiresToggle } from './ParamHiresToggle'; - -const selector = createSelector( - stateSelector, - (state) => { - const activeLabel = state.postprocessing.hiresFix ? 'Enabled' : undefined; - - return { activeLabel }; - }, - defaultSelectorOptions -); - -const ParamHiresCollapse = () => { - const { t } = useTranslation(); - const { activeLabel } = useAppSelector(selector); - - const isHiresEnabled = useFeatureStatus('hires').isFeatureEnabled; - - if (!isHiresEnabled) { - return null; - } - - return ( - - - - - - - ); -}; - -export default memo(ParamHiresCollapse); diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresHeight.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresHeight.tsx deleted file mode 100644 index 80a15f591b..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresHeight.tsx +++ /dev/null @@ -1,3 +0,0 @@ -// TODO - -export default {}; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresSteps.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresSteps.tsx deleted file mode 100644 index 80a15f591b..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresSteps.tsx +++ /dev/null @@ -1,3 +0,0 @@ -// TODO - -export default {}; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresStrength.tsx deleted file mode 100644 index 2655841590..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresStrength.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { createSelector } from '@reduxjs/toolkit'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISlider from 'common/components/IAISlider'; -import { postprocessingSelector } from 'features/parameters/store/postprocessingSelectors'; -import { setHiresStrength } from 'features/parameters/store/postprocessingSlice'; -import { isEqual } from 'lodash-es'; -import { useTranslation } from 'react-i18next'; - -const hiresStrengthSelector = createSelector( - [postprocessingSelector], - ({ hiresFix, hiresStrength }) => ({ hiresFix, hiresStrength }), - { - memoizeOptions: { - resultEqualityCheck: isEqual, - }, - } -); - -export const ParamHiresStrength = () => { - const { hiresFix, hiresStrength } = useAppSelector(hiresStrengthSelector); - - const dispatch = useAppDispatch(); - - const { t } = useTranslation(); - - const handleHiresStrength = (v: number) => { - dispatch(setHiresStrength(v)); - }; - - const handleHiResStrengthReset = () => { - dispatch(setHiresStrength(0.75)); - }; - - return ( - - ); -}; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresToggle.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresToggle.tsx deleted file mode 100644 index f8e6f22aa4..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresToggle.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import type { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISwitch from 'common/components/IAISwitch'; -import { setHiresFix } from 'features/parameters/store/postprocessingSlice'; -import { ChangeEvent } from 'react'; -import { useTranslation } from 'react-i18next'; - -/** - * Hires Fix Toggle - */ -export const ParamHiresToggle = () => { - const dispatch = useAppDispatch(); - - const hiresFix = useAppSelector( - (state: RootState) => state.postprocessing.hiresFix - ); - - const { t } = useTranslation(); - - const handleChangeHiresFix = (e: ChangeEvent) => - dispatch(setHiresFix(e.target.checked)); - - return ( - - ); -}; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresWidth.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresWidth.tsx deleted file mode 100644 index 80a15f591b..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Hires/ParamHiresWidth.tsx +++ /dev/null @@ -1,3 +0,0 @@ -// TODO - -export default {}; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamRealESRGANModel.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamRealESRGANModel.tsx new file mode 100644 index 0000000000..563165105b --- /dev/null +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamRealESRGANModel.tsx @@ -0,0 +1,58 @@ +import { SelectItem } from '@mantine/core'; +import type { RootState } from 'app/store/store'; +import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; +import IAIMantineSelect from 'common/components/IAIMantineSelect'; +import IAIMantineSelectItemWithTooltip from 'common/components/IAIMantineSelectItemWithTooltip'; +import { + ESRGANModelName, + esrganModelNameChanged, +} from 'features/parameters/store/postprocessingSlice'; +import { useTranslation } from 'react-i18next'; + +export const ESRGAN_MODEL_NAMES: SelectItem[] = [ + { + label: 'RealESRGAN x2 Plus', + value: 'RealESRGAN_x2plus.pth', + tooltip: 'Attempts to retain sharpness, low smoothing', + group: 'x2 Upscalers', + }, + { + label: 'RealESRGAN x4 Plus', + value: 'RealESRGAN_x4plus.pth', + tooltip: 'Best for photos and highly detailed images, medium smoothing', + group: 'x4 Upscalers', + }, + { + label: 'RealESRGAN x4 Plus (anime 6B)', + value: 'RealESRGAN_x4plus_anime_6B.pth', + tooltip: 'Best for anime/manga, high smoothing', + group: 'x4 Upscalers', + }, + { + label: 'ESRGAN SRx4', + value: 'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth', + tooltip: 'Retains sharpness, low smoothing', + group: 'x4 Upscalers', + }, +]; + +export default function ParamESRGANModel() { + const esrganModelName = useAppSelector( + (state: RootState) => state.postprocessing.esrganModelName + ); + + const dispatch = useAppDispatch(); + + const handleChange = (v: string) => + dispatch(esrganModelNameChanged(v as ESRGANModelName)); + + return ( + + ); +} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamUpscaleSettings.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamUpscaleSettings.tsx new file mode 100644 index 0000000000..5824c38123 --- /dev/null +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/ParamUpscaleSettings.tsx @@ -0,0 +1,62 @@ +import { Flex, useDisclosure } from '@chakra-ui/react'; +import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested'; +import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; +import IAIButton from 'common/components/IAIButton'; +import IAIIconButton from 'common/components/IAIIconButton'; +import IAIPopover from 'common/components/IAIPopover'; +import { selectIsBusy } from 'features/system/store/systemSelectors'; +import { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; +import { FaExpandArrowsAlt } from 'react-icons/fa'; +import { ImageDTO } from 'services/api/types'; +import ParamESRGANModel from './ParamRealESRGANModel'; + +type Props = { imageDTO?: ImageDTO }; + +const ParamUpscalePopover = (props: Props) => { + const { imageDTO } = props; + const dispatch = useAppDispatch(); + const isBusy = useAppSelector(selectIsBusy); + const { t } = useTranslation(); + const { isOpen, onOpen, onClose } = useDisclosure(); + + const handleClickUpscale = useCallback(() => { + onClose(); + if (!imageDTO) { + return; + } + dispatch(upscaleRequested({ image_name: imageDTO.image_name })); + }, [dispatch, imageDTO, onClose]); + + return ( + } + aria-label={t('parameters.upscale')} + /> + } + > + + + + {t('parameters.upscaleImage')} + + + + ); +}; + +export default ParamUpscalePopover; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleDenoisingStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleDenoisingStrength.tsx deleted file mode 100644 index 7abcd55c03..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleDenoisingStrength.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISlider from 'common/components/IAISlider'; -import { setUpscalingDenoising } from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function UpscaleDenoisingStrength() { - const isESRGANAvailable = useAppSelector( - (state: RootState) => state.system.isESRGANAvailable - ); - - const upscalingDenoising = useAppSelector( - (state: RootState) => state.postprocessing.upscalingDenoising - ); - - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - - return ( - { - dispatch(setUpscalingDenoising(v)); - }} - handleReset={() => dispatch(setUpscalingDenoising(0.75))} - withSliderMarks - withInput - withReset - isDisabled={!isESRGANAvailable} - /> - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleScale.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleScale.tsx deleted file mode 100644 index 1e15d212e2..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleScale.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { UPSCALING_LEVELS } from 'app/constants'; -import type { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAIMantineSearchableSelect from 'common/components/IAIMantineSearchableSelect'; -import { - UpscalingLevel, - setUpscalingLevel, -} from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function UpscaleScale() { - const isESRGANAvailable = useAppSelector( - (state: RootState) => state.system.isESRGANAvailable - ); - - const upscalingLevel = useAppSelector( - (state: RootState) => state.postprocessing.upscalingLevel - ); - - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - - const handleChangeLevel = (v: string) => - dispatch(setUpscalingLevel(Number(v) as UpscalingLevel)); - - return ( - - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleSettings.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleSettings.tsx deleted file mode 100644 index 291b8f9dc2..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleSettings.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { VStack } from '@chakra-ui/react'; -import UpscaleDenoisingStrength from './UpscaleDenoisingStrength'; -import UpscaleStrength from './UpscaleStrength'; -import UpscaleScale from './UpscaleScale'; - -/** - * Displays upscaling/ESRGAN options (level and strength). - */ -const UpscaleSettings = () => { - return ( - - - - - - ); -}; - -export default UpscaleSettings; diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleStrength.tsx deleted file mode 100644 index 68f61cf1e0..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleStrength.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISlider from 'common/components/IAISlider'; -import { setUpscalingStrength } from 'features/parameters/store/postprocessingSlice'; -import { useTranslation } from 'react-i18next'; - -export default function UpscaleStrength() { - const isESRGANAvailable = useAppSelector( - (state: RootState) => state.system.isESRGANAvailable - ); - const upscalingStrength = useAppSelector( - (state: RootState) => state.postprocessing.upscalingStrength - ); - - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - - return ( - dispatch(setUpscalingStrength(v))} - handleReset={() => dispatch(setUpscalingStrength(0.75))} - withSliderMarks - withInput - withReset - isDisabled={!isESRGANAvailable} - /> - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleToggle.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleToggle.tsx deleted file mode 100644 index 172a9f2de9..0000000000 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Upscale/UpscaleToggle.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { RootState } from 'app/store/store'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import IAISwitch from 'common/components/IAISwitch'; -import { setShouldRunESRGAN } from 'features/parameters/store/postprocessingSlice'; -import { ChangeEvent } from 'react'; - -export default function UpscaleToggle() { - const isESRGANAvailable = useAppSelector( - (state: RootState) => state.system.isESRGANAvailable - ); - - const shouldRunESRGAN = useAppSelector( - (state: RootState) => state.postprocessing.shouldRunESRGAN - ); - - const dispatch = useAppDispatch(); - const handleChangeShouldRunESRGAN = (e: ChangeEvent) => - dispatch(setShouldRunESRGAN(e.target.checked)); - return ( - - ); -} diff --git a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts index 399a474008..a1fbf3648f 100644 --- a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts @@ -1,98 +1,27 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit'; -import { FACETOOL_TYPES } from 'app/constants'; +import { ESRGANInvocation } from 'services/api/types'; -export type UpscalingLevel = 2 | 4; - -export type FacetoolType = (typeof FACETOOL_TYPES)[number]; +export type ESRGANModelName = NonNullable; export interface PostprocessingState { - codeformerFidelity: number; - facetoolStrength: number; - facetoolType: FacetoolType; - hiresFix: boolean; - hiresStrength: number; - shouldLoopback: boolean; - shouldRunESRGAN: boolean; - shouldRunFacetool: boolean; - upscalingLevel: UpscalingLevel; - upscalingDenoising: number; - upscalingStrength: number; + esrganModelName: ESRGANModelName; } export const initialPostprocessingState: PostprocessingState = { - codeformerFidelity: 0.75, - facetoolStrength: 0.75, - facetoolType: 'gfpgan', - hiresFix: false, - hiresStrength: 0.75, - shouldLoopback: false, - shouldRunESRGAN: false, - shouldRunFacetool: false, - upscalingLevel: 4, - upscalingDenoising: 0.75, - upscalingStrength: 0.75, + esrganModelName: 'RealESRGAN_x4plus.pth', }; export const postprocessingSlice = createSlice({ name: 'postprocessing', initialState: initialPostprocessingState, reducers: { - setFacetoolStrength: (state, action: PayloadAction) => { - state.facetoolStrength = action.payload; - }, - setCodeformerFidelity: (state, action: PayloadAction) => { - state.codeformerFidelity = action.payload; - }, - setUpscalingLevel: (state, action: PayloadAction) => { - state.upscalingLevel = action.payload; - }, - setUpscalingDenoising: (state, action: PayloadAction) => { - state.upscalingDenoising = action.payload; - }, - setUpscalingStrength: (state, action: PayloadAction) => { - state.upscalingStrength = action.payload; - }, - setHiresFix: (state, action: PayloadAction) => { - state.hiresFix = action.payload; - }, - setHiresStrength: (state, action: PayloadAction) => { - state.hiresStrength = action.payload; - }, - resetPostprocessingState: (state) => { - return { - ...state, - ...initialPostprocessingState, - }; - }, - setShouldRunFacetool: (state, action: PayloadAction) => { - state.shouldRunFacetool = action.payload; - }, - setFacetoolType: (state, action: PayloadAction) => { - state.facetoolType = action.payload; - }, - setShouldRunESRGAN: (state, action: PayloadAction) => { - state.shouldRunESRGAN = action.payload; - }, - setShouldLoopback: (state, action: PayloadAction) => { - state.shouldLoopback = action.payload; + esrganModelNameChanged: (state, action: PayloadAction) => { + state.esrganModelName = action.payload; }, }, }); -export const { - resetPostprocessingState, - setCodeformerFidelity, - setFacetoolStrength, - setFacetoolType, - setHiresFix, - setHiresStrength, - setShouldLoopback, - setShouldRunESRGAN, - setShouldRunFacetool, - setUpscalingLevel, - setUpscalingDenoising, - setUpscalingStrength, -} = postprocessingSlice.actions; +export const { esrganModelNameChanged } = postprocessingSlice.actions; export default postprocessingSlice.reducer; diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageTabParameters.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageTabParameters.tsx index ed1c3dd706..3d3fd87851 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageTabParameters.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageTabParameters.tsx @@ -4,7 +4,6 @@ import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Adv import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse'; import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning'; import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning'; -import ParamHiresCollapse from 'features/parameters/components/Parameters/Hires/ParamHiresCollapse'; import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse'; import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse'; import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse'; @@ -26,7 +25,6 @@ const TextToImageTabParameters = () => { - diff --git a/invokeai/frontend/web/src/services/api/types.d.ts b/invokeai/frontend/web/src/services/api/types.d.ts index 850426d8ba..829b96840e 100644 --- a/invokeai/frontend/web/src/services/api/types.d.ts +++ b/invokeai/frontend/web/src/services/api/types.d.ts @@ -90,6 +90,9 @@ export type InpaintInvocation = TypeReq< export type ImageResizeInvocation = TypeReq< components['schemas']['ImageResizeInvocation'] >; +export type ImageScaleInvocation = TypeReq< + components['schemas']['ImageScaleInvocation'] +>; export type RandomIntInvocation = TypeReq< components['schemas']['RandomIntInvocation'] >; @@ -124,6 +127,12 @@ export type LoraLoaderInvocation = TypeReq< export type MetadataAccumulatorInvocation = TypeReq< components['schemas']['MetadataAccumulatorInvocation'] >; +export type ESRGANInvocation = TypeReq< + components['schemas']['ESRGANInvocation'] +>; +export type DivideInvocation = TypeReq< + components['schemas']['DivideInvocation'] +>; // ControlNet Nodes export type ControlNetInvocation = TypeReq< From 416afd2781e6e0c9e250fa1ffafd4c010cf0af15 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:04:43 +1000 Subject: [PATCH 4/5] chore(ui): regen types --- .../frontend/web/src/services/api/schema.d.ts | 535 +++++++++++++++++- 1 file changed, 531 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/schema.d.ts b/invokeai/frontend/web/src/services/api/schema.d.ts index e9ff24a2e1..cd832e833d 100644 --- a/invokeai/frontend/web/src/services/api/schema.d.ts +++ b/invokeai/frontend/web/src/services/api/schema.d.ts @@ -1254,7 +1254,7 @@ export type components = { * @description The nodes in this graph */ nodes?: { - [key: string]: (components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]) | undefined; + [key: string]: (components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]) | undefined; }; /** * Edges @@ -1297,7 +1297,7 @@ export type components = { * @description The results of node executions */ results: { - [key: string]: (components["schemas"]["ImageOutput"] | components["schemas"]["MaskOutput"] | components["schemas"]["ControlOutput"] | components["schemas"]["ModelLoaderOutput"] | components["schemas"]["LoraLoaderOutput"] | components["schemas"]["VaeLoaderOutput"] | components["schemas"]["MetadataAccumulatorOutput"] | components["schemas"]["IntCollectionOutput"] | components["schemas"]["FloatCollectionOutput"] | components["schemas"]["ImageCollectionOutput"] | components["schemas"]["CompelOutput"] | components["schemas"]["ClipSkipInvocationOutput"] | components["schemas"]["LatentsOutput"] | components["schemas"]["IntOutput"] | components["schemas"]["FloatOutput"] | components["schemas"]["NoiseOutput"] | components["schemas"]["PromptOutput"] | components["schemas"]["PromptCollectionOutput"] | components["schemas"]["SDXLModelLoaderOutput"] | components["schemas"]["SDXLRefinerModelLoaderOutput"] | components["schemas"]["GraphInvocationOutput"] | components["schemas"]["IterateInvocationOutput"] | components["schemas"]["CollectInvocationOutput"]) | undefined; + [key: string]: (components["schemas"]["ImageOutput"] | components["schemas"]["MaskOutput"] | components["schemas"]["ControlOutput"] | components["schemas"]["ModelLoaderOutput"] | components["schemas"]["LoraLoaderOutput"] | components["schemas"]["VaeLoaderOutput"] | components["schemas"]["MetadataAccumulatorOutput"] | components["schemas"]["CompelOutput"] | components["schemas"]["ClipSkipInvocationOutput"] | components["schemas"]["LatentsOutput"] | components["schemas"]["SDXLModelLoaderOutput"] | components["schemas"]["SDXLRefinerModelLoaderOutput"] | components["schemas"]["PromptOutput"] | components["schemas"]["PromptCollectionOutput"] | components["schemas"]["IntOutput"] | components["schemas"]["FloatOutput"] | components["schemas"]["IntCollectionOutput"] | components["schemas"]["FloatCollectionOutput"] | components["schemas"]["ImageCollectionOutput"] | components["schemas"]["NoiseOutput"] | components["schemas"]["GraphInvocationOutput"] | components["schemas"]["IterateInvocationOutput"] | components["schemas"]["CollectInvocationOutput"]) | undefined; }; /** * Errors @@ -4087,6 +4087,533 @@ export type components = { * @enum {string} */ ResourceOrigin: "internal" | "external"; + /** + * SDXLCompelPromptInvocation + * @description Parse prompt using compel package to conditioning. + */ + SDXLCompelPromptInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_compel_prompt + * @enum {string} + */ + type?: "sdxl_compel_prompt"; + /** + * Prompt + * @description Prompt + * @default + */ + prompt?: string; + /** + * Style + * @description Style prompt + * @default + */ + style?: string; + /** + * Original Width + * @default 1024 + */ + original_width?: number; + /** + * Original Height + * @default 1024 + */ + original_height?: number; + /** + * Crop Top + * @default 0 + */ + crop_top?: number; + /** + * Crop Left + * @default 0 + */ + crop_left?: number; + /** + * Target Width + * @default 1024 + */ + target_width?: number; + /** + * Target Height + * @default 1024 + */ + target_height?: number; + /** + * Clip1 + * @description Clip to use + */ + clip1?: components["schemas"]["ClipField"]; + /** + * Clip2 + * @description Clip to use + */ + clip2?: components["schemas"]["ClipField"]; + }; + /** + * SDXLLatentsToLatentsInvocation + * @description Generates latents from conditionings. + */ + SDXLLatentsToLatentsInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default l2l_sdxl + * @enum {string} + */ + type?: "l2l_sdxl"; + /** + * Positive Conditioning + * @description Positive conditioning for generation + */ + positive_conditioning?: components["schemas"]["ConditioningField"]; + /** + * Negative Conditioning + * @description Negative conditioning for generation + */ + negative_conditioning?: components["schemas"]["ConditioningField"]; + /** + * Noise + * @description The noise to use + */ + noise?: components["schemas"]["LatentsField"]; + /** + * Steps + * @description The number of steps to use to generate the image + * @default 10 + */ + steps?: number; + /** + * Cfg Scale + * @description The Classifier-Free Guidance, higher values may result in a result closer to the prompt + * @default 7.5 + */ + cfg_scale?: number | (number)[]; + /** + * Scheduler + * @description The scheduler to use + * @default euler + * @enum {string} + */ + scheduler?: "ddim" | "ddpm" | "deis" | "lms" | "lms_k" | "pndm" | "heun" | "heun_k" | "euler" | "euler_k" | "euler_a" | "kdpm_2" | "kdpm_2_a" | "dpmpp_2s" | "dpmpp_2s_k" | "dpmpp_2m" | "dpmpp_2m_k" | "dpmpp_2m_sde" | "dpmpp_2m_sde_k" | "dpmpp_sde" | "dpmpp_sde_k" | "unipc"; + /** + * Unet + * @description UNet submodel + */ + unet?: components["schemas"]["UNetField"]; + /** + * Latents + * @description Initial latents + */ + latents?: components["schemas"]["LatentsField"]; + /** + * Denoising Start + * @default 0 + */ + denoising_start?: number; + /** + * Denoising End + * @default 1 + */ + denoising_end?: number; + }; + /** + * SDXLModelLoaderInvocation + * @description Loads an sdxl base model, outputting its submodels. + */ + SDXLModelLoaderInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_model_loader + * @enum {string} + */ + type?: "sdxl_model_loader"; + /** + * Model + * @description The model to load + */ + model: components["schemas"]["MainModelField"]; + }; + /** + * SDXLModelLoaderOutput + * @description SDXL base model loader output + */ + SDXLModelLoaderOutput: { + /** + * Type + * @default sdxl_model_loader_output + * @enum {string} + */ + type?: "sdxl_model_loader_output"; + /** + * Unet + * @description UNet submodel + */ + unet?: components["schemas"]["UNetField"]; + /** + * Clip + * @description Tokenizer and text_encoder submodels + */ + clip?: components["schemas"]["ClipField"]; + /** + * Clip2 + * @description Tokenizer and text_encoder submodels + */ + clip2?: components["schemas"]["ClipField"]; + /** + * Vae + * @description Vae submodel + */ + vae?: components["schemas"]["VaeField"]; + }; + /** + * SDXLRawPromptInvocation + * @description Pass unmodified prompt to conditioning without compel processing. + */ + SDXLRawPromptInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_raw_prompt + * @enum {string} + */ + type?: "sdxl_raw_prompt"; + /** + * Prompt + * @description Prompt + * @default + */ + prompt?: string; + /** + * Style + * @description Style prompt + * @default + */ + style?: string; + /** + * Original Width + * @default 1024 + */ + original_width?: number; + /** + * Original Height + * @default 1024 + */ + original_height?: number; + /** + * Crop Top + * @default 0 + */ + crop_top?: number; + /** + * Crop Left + * @default 0 + */ + crop_left?: number; + /** + * Target Width + * @default 1024 + */ + target_width?: number; + /** + * Target Height + * @default 1024 + */ + target_height?: number; + /** + * Clip1 + * @description Clip to use + */ + clip1?: components["schemas"]["ClipField"]; + /** + * Clip2 + * @description Clip to use + */ + clip2?: components["schemas"]["ClipField"]; + }; + /** + * SDXLRefinerCompelPromptInvocation + * @description Parse prompt using compel package to conditioning. + */ + SDXLRefinerCompelPromptInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_refiner_compel_prompt + * @enum {string} + */ + type?: "sdxl_refiner_compel_prompt"; + /** + * Style + * @description Style prompt + * @default + */ + style?: string; + /** + * Original Width + * @default 1024 + */ + original_width?: number; + /** + * Original Height + * @default 1024 + */ + original_height?: number; + /** + * Crop Top + * @default 0 + */ + crop_top?: number; + /** + * Crop Left + * @default 0 + */ + crop_left?: number; + /** + * Aesthetic Score + * @default 6 + */ + aesthetic_score?: number; + /** + * Clip2 + * @description Clip to use + */ + clip2?: components["schemas"]["ClipField"]; + }; + /** + * SDXLRefinerModelLoaderInvocation + * @description Loads an sdxl refiner model, outputting its submodels. + */ + SDXLRefinerModelLoaderInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_refiner_model_loader + * @enum {string} + */ + type?: "sdxl_refiner_model_loader"; + /** + * Model + * @description The model to load + */ + model: components["schemas"]["MainModelField"]; + }; + /** + * SDXLRefinerModelLoaderOutput + * @description SDXL refiner model loader output + */ + SDXLRefinerModelLoaderOutput: { + /** + * Type + * @default sdxl_refiner_model_loader_output + * @enum {string} + */ + type?: "sdxl_refiner_model_loader_output"; + /** + * Unet + * @description UNet submodel + */ + unet?: components["schemas"]["UNetField"]; + /** + * Clip2 + * @description Tokenizer and text_encoder submodels + */ + clip2?: components["schemas"]["ClipField"]; + /** + * Vae + * @description Vae submodel + */ + vae?: components["schemas"]["VaeField"]; + }; + /** + * SDXLRefinerRawPromptInvocation + * @description Parse prompt using compel package to conditioning. + */ + SDXLRefinerRawPromptInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default sdxl_refiner_raw_prompt + * @enum {string} + */ + type?: "sdxl_refiner_raw_prompt"; + /** + * Style + * @description Style prompt + * @default + */ + style?: string; + /** + * Original Width + * @default 1024 + */ + original_width?: number; + /** + * Original Height + * @default 1024 + */ + original_height?: number; + /** + * Crop Top + * @default 0 + */ + crop_top?: number; + /** + * Crop Left + * @default 0 + */ + crop_left?: number; + /** + * Aesthetic Score + * @default 6 + */ + aesthetic_score?: number; + /** + * Clip2 + * @description Clip to use + */ + clip2?: components["schemas"]["ClipField"]; + }; + /** + * SDXLTextToLatentsInvocation + * @description Generates latents from conditionings. + */ + SDXLTextToLatentsInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default t2l_sdxl + * @enum {string} + */ + type?: "t2l_sdxl"; + /** + * Positive Conditioning + * @description Positive conditioning for generation + */ + positive_conditioning?: components["schemas"]["ConditioningField"]; + /** + * Negative Conditioning + * @description Negative conditioning for generation + */ + negative_conditioning?: components["schemas"]["ConditioningField"]; + /** + * Noise + * @description The noise to use + */ + noise?: components["schemas"]["LatentsField"]; + /** + * Steps + * @description The number of steps to use to generate the image + * @default 10 + */ + steps?: number; + /** + * Cfg Scale + * @description The Classifier-Free Guidance, higher values may result in a result closer to the prompt + * @default 7.5 + */ + cfg_scale?: number | (number)[]; + /** + * Scheduler + * @description The scheduler to use + * @default euler + * @enum {string} + */ + scheduler?: "ddim" | "ddpm" | "deis" | "lms" | "lms_k" | "pndm" | "heun" | "heun_k" | "euler" | "euler_k" | "euler_a" | "kdpm_2" | "kdpm_2_a" | "dpmpp_2s" | "dpmpp_2s_k" | "dpmpp_2m" | "dpmpp_2m_k" | "dpmpp_2m_sde" | "dpmpp_2m_sde_k" | "dpmpp_sde" | "dpmpp_sde_k" | "unipc"; + /** + * Unet + * @description UNet submodel + */ + unet?: components["schemas"]["UNetField"]; + /** + * Denoising End + * @default 1 + */ + denoising_end?: number; + }; /** * ScaleLatentsInvocation * @description Scales latents by a given factor. @@ -4853,7 +5380,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; + "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; }; }; responses: { @@ -4890,7 +5417,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; + "application/json": components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["SDXLRawPromptInvocation"] | components["schemas"]["SDXLRefinerRawPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["TextToLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["SDXLTextToLatentsInvocation"] | components["schemas"]["SDXLLatentsToLatentsInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["InpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["LatentsToLatentsInvocation"]; }; }; responses: { From 4ada094c5c2c88341ec203e206f86bdc94d638fe Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 19 Jul 2023 09:45:26 +1000 Subject: [PATCH 5/5] tests(nodes): fix tests due to referencing renamed node --- tests/nodes/test_node_graph.py | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/nodes/test_node_graph.py b/tests/nodes/test_node_graph.py index c86be19059..cd995141ab 100644 --- a/tests/nodes/test_node_graph.py +++ b/tests/nodes/test_node_graph.py @@ -1,6 +1,6 @@ from .test_nodes import ImageToImageTestInvocation, TextToImageTestInvocation, ListPassThroughInvocation, PromptTestInvocation from invokeai.app.services.graph import Edge, Graph, GraphInvocation, InvalidEdgeError, NodeAlreadyInGraphError, NodeNotFoundError, are_connections_compatible, EdgeConnection, CollectInvocation, IterateInvocation -from invokeai.app.invocations.upscale import RealESRGANInvocation +from invokeai.app.invocations.upscale import ESRGANInvocation from invokeai.app.invocations.image import * from invokeai.app.invocations.math import AddInvocation, SubtractInvocation from invokeai.app.invocations.params import ParamIntInvocation @@ -19,7 +19,7 @@ def create_edge(from_id: str, from_field: str, to_id: str, to_field: str) -> Edg def test_connections_are_compatible(): from_node = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") from_field = "image" - to_node = RealESRGANInvocation(id = "2") + to_node = ESRGANInvocation(id = "2") to_field = "image" result = are_connections_compatible(from_node, from_field, to_node, to_field) @@ -29,7 +29,7 @@ def test_connections_are_compatible(): def test_connections_are_incompatible(): from_node = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") from_field = "image" - to_node = RealESRGANInvocation(id = "2") + to_node = ESRGANInvocation(id = "2") to_field = "strength" result = are_connections_compatible(from_node, from_field, to_node, to_field) @@ -39,7 +39,7 @@ def test_connections_are_incompatible(): def test_connections_incompatible_with_invalid_fields(): from_node = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") from_field = "invalid_field" - to_node = RealESRGANInvocation(id = "2") + to_node = ESRGANInvocation(id = "2") to_field = "image" # From field is invalid @@ -86,10 +86,10 @@ def test_graph_fails_to_update_node_if_type_changes(): g = Graph() n = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") g.add_node(n) - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n2) - nu = RealESRGANInvocation(id = "1") + nu = ESRGANInvocation(id = "1") with pytest.raises(TypeError): g.update_node("1", nu) @@ -98,7 +98,7 @@ def test_graph_allows_non_conflicting_id_change(): g = Graph() n = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") g.add_node(n) - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n2) e1 = create_edge(n.id,"image",n2.id,"image") g.add_edge(e1) @@ -128,7 +128,7 @@ def test_graph_fails_to_update_node_id_if_conflict(): def test_graph_adds_edge(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e = create_edge(n1.id,"image",n2.id,"image") @@ -139,7 +139,7 @@ def test_graph_adds_edge(): def test_graph_fails_to_add_edge_with_cycle(): g = Graph() - n1 = RealESRGANInvocation(id = "1") + n1 = ESRGANInvocation(id = "1") g.add_node(n1) e = create_edge(n1.id,"image",n1.id,"image") with pytest.raises(InvalidEdgeError): @@ -148,8 +148,8 @@ def test_graph_fails_to_add_edge_with_cycle(): def test_graph_fails_to_add_edge_with_long_cycle(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") - n3 = RealESRGANInvocation(id = "3") + n2 = ESRGANInvocation(id = "2") + n3 = ESRGANInvocation(id = "3") g.add_node(n1) g.add_node(n2) g.add_node(n3) @@ -164,7 +164,7 @@ def test_graph_fails_to_add_edge_with_long_cycle(): def test_graph_fails_to_add_edge_with_missing_node_id(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e1 = create_edge("1","image","3","image") @@ -177,8 +177,8 @@ def test_graph_fails_to_add_edge_with_missing_node_id(): def test_graph_fails_to_add_edge_when_destination_exists(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") - n3 = RealESRGANInvocation(id = "3") + n2 = ESRGANInvocation(id = "2") + n3 = ESRGANInvocation(id = "3") g.add_node(n1) g.add_node(n2) g.add_node(n3) @@ -194,7 +194,7 @@ def test_graph_fails_to_add_edge_when_destination_exists(): def test_graph_fails_to_add_edge_with_mismatched_types(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e1 = create_edge("1","image","2","strength") @@ -344,7 +344,7 @@ def test_graph_iterator_invalid_if_output_and_input_types_different(): def test_graph_validates(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e1 = create_edge("1","image","2","image") @@ -377,8 +377,8 @@ def test_graph_invalid_if_subgraph_invalid(): def test_graph_invalid_if_has_cycle(): g = Graph() - n1 = RealESRGANInvocation(id = "1") - n2 = RealESRGANInvocation(id = "2") + n1 = ESRGANInvocation(id = "1") + n2 = ESRGANInvocation(id = "2") g.nodes[n1.id] = n1 g.nodes[n2.id] = n2 e1 = create_edge("1","image","2","image") @@ -391,7 +391,7 @@ def test_graph_invalid_if_has_cycle(): def test_graph_invalid_with_invalid_connection(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.nodes[n1.id] = n1 g.nodes[n2.id] = n2 e1 = create_edge("1","image","2","strength") @@ -503,7 +503,7 @@ def test_graph_fails_to_enumerate_non_subgraph_node(): g.add_node(n1) - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n2) with pytest.raises(NodeNotFoundError): @@ -512,7 +512,7 @@ def test_graph_fails_to_enumerate_non_subgraph_node(): def test_graph_gets_networkx_graph(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e = create_edge(n1.id,"image",n2.id,"image") @@ -529,7 +529,7 @@ def test_graph_gets_networkx_graph(): def test_graph_can_serialize(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e = create_edge(n1.id,"image",n2.id,"image") @@ -541,7 +541,7 @@ def test_graph_can_serialize(): def test_graph_can_deserialize(): g = Graph() n1 = TextToImageTestInvocation(id = "1", prompt = "Banana sushi") - n2 = RealESRGANInvocation(id = "2") + n2 = ESRGANInvocation(id = "2") g.add_node(n1) g.add_node(n2) e = create_edge(n1.id,"image",n2.id,"image")