aboutsummaryrefslogtreecommitdiffstats
path: root/modules/api/models.py
diff options
context:
space:
mode:
authorguaneec <guaneec@users.noreply.github.com>2022-10-26 06:58:04 +0000
committerGitHub <noreply@github.com>2022-10-26 06:58:04 +0000
commit649d79a8ecd20ccf3c375f7116eee4809f844e3c (patch)
tree0259f0c01540da824c706b7626d5930ebaca9d01 /modules/api/models.py
parent877d94f97ca5491d8779440769b191e0dcd32c8e (diff)
parent757264c453eca533ee1c9ea7e9d9b45a009367d7 (diff)
downloadstable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.tar.gz
stable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.tar.bz2
stable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.zip
Merge branch 'master' into hn-activation
Diffstat (limited to 'modules/api/models.py')
-rw-r--r--modules/api/models.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/api/models.py b/modules/api/models.py
index f551fa35..079e33d9 100644
--- a/modules/api/models.py
+++ b/modules/api/models.py
@@ -31,6 +31,7 @@ class ModelDef(BaseModel):
field_alias: str
field_type: Any
field_value: Any
+ field_exclude: bool = False
class PydanticModelGenerator:
@@ -78,7 +79,8 @@ class PydanticModelGenerator:
field=underscore(fields["key"]),
field_alias=fields["key"],
field_type=fields["type"],
- field_value=fields["default"]))
+ field_value=fields["default"],
+ field_exclude=fields["exclude"] if "exclude" in fields else False))
def generate_model(self):
"""
@@ -86,7 +88,7 @@ class PydanticModelGenerator:
from the json and overrides provided at initialization
"""
fields = {
- d.field: (d.field_type, Field(default=d.field_value, alias=d.field_alias)) for d in self._model_def
+ d.field: (d.field_type, Field(default=d.field_value, alias=d.field_alias, exclude=d.field_exclude)) for d in self._model_def
}
DynamicModel = create_model(self._model_name, **fields)
DynamicModel.__config__.allow_population_by_field_name = True
@@ -102,5 +104,5 @@ StableDiffusionTxt2ImgProcessingAPI = PydanticModelGenerator(
StableDiffusionImg2ImgProcessingAPI = PydanticModelGenerator(
"StableDiffusionProcessingImg2Img",
StableDiffusionProcessingImg2Img,
- [{"key": "sampler_index", "type": str, "default": "Euler"}, {"key": "init_images", "type": list, "default": None}, {"key": "denoising_strength", "type": float, "default": 0.75}, {"key": "mask", "type": str, "default": None}]
+ [{"key": "sampler_index", "type": str, "default": "Euler"}, {"key": "init_images", "type": list, "default": None}, {"key": "denoising_strength", "type": float, "default": 0.75}, {"key": "mask", "type": str, "default": None}, {"key": "include_init_images", "type": bool, "default": False, "exclude" : True}]
).generate_model() \ No newline at end of file