aboutsummaryrefslogtreecommitdiffstats
path: root/modules/api/models.py
diff options
context:
space:
mode:
authorRobert Barron <rubberbaron@robustspread.com>2023-08-14 07:35:17 +0000
committerRobert Barron <rubberbaron@robustspread.com>2023-08-14 07:35:17 +0000
commitd61e31bae620632c026c927cf6538180447c6918 (patch)
tree0397dcc8e741ed391164fb6b7e8e374a46f0f4ce /modules/api/models.py
parent54f926b11d29910df9f813e2e0ea6d35c6f4a50d (diff)
parentf3b96d4998d8ca376d33efa7a4454e8c28e24255 (diff)
downloadstable-diffusion-webui-gfx803-d61e31bae620632c026c927cf6538180447c6918.tar.gz
stable-diffusion-webui-gfx803-d61e31bae620632c026c927cf6538180447c6918.tar.bz2
stable-diffusion-webui-gfx803-d61e31bae620632c026c927cf6538180447c6918.zip
Merge remote-tracking branch 'auto1111/dev' into shared-hires-prompt-test
Diffstat (limited to 'modules/api/models.py')
-rw-r--r--modules/api/models.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/api/models.py b/modules/api/models.py
index 800c9b93..6a574771 100644
--- a/modules/api/models.py
+++ b/modules/api/models.py
@@ -50,10 +50,12 @@ class PydanticModelGenerator:
additional_fields = None,
):
def field_type_generator(k, v):
- # field_type = str if not overrides.get(k) else overrides[k]["type"]
- # print(k, v.annotation, v.default)
field_type = v.annotation
+ if field_type == 'Image':
+ # images are sent as base64 strings via API
+ field_type = 'str'
+
return Optional[field_type]
def merge_class_params(class_):
@@ -63,7 +65,6 @@ class PydanticModelGenerator:
parameters = {**parameters, **inspect.signature(classes.__init__).parameters}
return parameters
-
self._model_name = model_name
self._class_data = merge_class_params(class_instance)
@@ -72,7 +73,7 @@ class PydanticModelGenerator:
field=underscore(k),
field_alias=k,
field_type=field_type_generator(k, v),
- field_value=v.default
+ field_value=None if isinstance(v.default, property) else v.default
)
for (k,v) in self._class_data.items() if k not in API_NOT_ALLOWED
]