revert and disable auto-formatting of invocations

This commit is contained in:
Lincoln Stein 2023-03-03 14:59:17 -05:00
parent dd4a1c998b
commit 6477e31c1e
6 changed files with 25 additions and 50 deletions

View File

@ -26,45 +26,18 @@ class TextToImageInvocation(BaseInvocation):
# Inputs
# TODO: consider making prompt optional to enable providing prompt through a link
# fmt: off
prompt: Optional[str] = Field(description="The prompt to generate an image from")
seed: int = Field(
default=-1,
ge=-1,
le=np.iinfo(np.uint32).max,
description="The seed to use (-1 for a random seed)",
)
steps: int = Field(
default=10, gt=0, description="The number of steps to use to generate the image"
)
width: int = Field(
default=512,
multiple_of=64,
gt=0,
description="The width of the resulting image",
)
height: int = Field(
default=512,
multiple_of=64,
gt=0,
description="The height of the resulting image",
)
cfg_scale: float = Field(
default=7.5,
gt=0,
description="The Classifier-Free Guidance, higher values may result in a result closer to the prompt",
)
sampler_name: SAMPLER_NAME_VALUES = Field(
default="k_lms", description="The sampler to use"
)
seamless: bool = Field(
default=False,
description="Whether or not to generate an image that can tile without seams",
)
model: str = Field(default="", description="The model to use (currently ignored)")
progress_images: bool = Field(
default=False,
description="Whether or not to produce progress images during generation",
)
seed: int = Field(default=-1,ge=-1, le=np.iinfo(np.uint32).max, description="The seed to use (-1 for a random seed)", )
steps: int = Field(default=10, gt=0, description="The number of steps to use to generate the image")
width: int = Field(default=512, multiple_of=64, gt=0, description="The width of the resulting image", )
height: int = Field(default=512, multiple_of=64, gt=0, description="The height of the resulting image", )
cfg_scale: float = Field(default=7.5, gt=0, description="The Classifier-Free Guidance, higher values may result in a result closer to the prompt", )
sampler_name: SAMPLER_NAME_VALUES = Field(default="k_lms", description="The sampler to use" )
seamless: bool = Field(default=False, description="Whether or not to generate an image that can tile without seams", )
model: str = Field(default="", description="The model to use (currently ignored)")
progress_images: bool = Field(default=False, description="Whether or not to produce progress images during generation", )
# fmt: on
# TODO: pass this an emitter method or something? or a session for dispatching?
def dispatch_progress(

View File

@ -260,14 +260,15 @@ class LerpInvocation(BaseInvocation):
class InverseLerpInvocation(BaseInvocation):
"""Inverse linear interpolation of all pixels of an image"""
#fmt: off
type: Literal["ilerp"] = "ilerp"
# Inputs
image: ImageField = Field(default=None, description="The image to lerp")
min: int = Field(default=0, ge=0, le=255, description="The minimum input value")
max: int = Field(default=255, ge=0, le=255, description="The maximum input value")
#fmt: on
def invoke(self, context: InvocationContext) -> ImageOutput:
image = context.services.images.get(
self.image.image_type, self.image.image_name

View File

@ -7,7 +7,8 @@ from .baseinvocation import BaseInvocationOutput
class PromptOutput(BaseInvocationOutput):
"""Base class for invocations that output a prompt"""
#fmt: off
type: Literal["prompt"] = "prompt"
prompt: str = Field(default=None, description="The output prompt")
#fmt: on

View File

@ -11,15 +11,14 @@ from .image import ImageField, ImageOutput
class RestoreFaceInvocation(BaseInvocation):
"""Restores faces in an image."""
type: Literal["restore_face"] = "restore_face"
#fmt: off
type: Literal["restore_face"] = "restore_face"
# Inputs
image: Union[ImageField, None] = Field(description="The input image")
strength: float = Field(
default=0.75, gt=0, le=1, description="The strength of the restoration"
)
strength: float = Field(default=0.75, gt=0, le=1, description="The strength of the restoration" )
#fmt: on
def invoke(self, context: InvocationContext) -> ImageOutput:
image = context.services.images.get(
self.image.image_type, self.image.image_name

View File

@ -13,13 +13,14 @@ from .image import ImageField, ImageOutput
class UpscaleInvocation(BaseInvocation):
"""Upscales an image."""
#fmt: off
type: Literal["upscale"] = "upscale"
# Inputs
image: Union[ImageField, None] = Field(description="The input image", default=None)
strength: float = Field(default=0.75, gt=0, le=1, description="The strength")
level: Literal[2, 4] = Field(default=2, description="The upscale level")
#fmt: on
def invoke(self, context: InvocationContext) -> ImageOutput:
image = context.services.images.get(

View File

@ -9,13 +9,13 @@ T = TypeVar("T", bound=BaseModel)
class PaginatedResults(GenericModel, Generic[T]):
"""Paginated results"""
#fmt: off
items: list[T] = Field(description="Items")
page: int = Field(description="Current Page")
pages: int = Field(description="Total number of pages")
per_page: int = Field(description="Number of items per page")
total: int = Field(description="Total number of items in result")
#fmt: on
class ItemStorageABC(ABC, Generic[T]):
_on_changed_callbacks: list[Callable[[T], None]]