mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
also make None a valid option for options API for #11854
This commit is contained in:
parent
6be5ccb530
commit
420cc8f68e
@ -1,4 +1,6 @@
|
|||||||
import inspect
|
import inspect
|
||||||
|
import types
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, create_model
|
from pydantic import BaseModel, Field, create_model
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
@ -207,11 +209,14 @@ class PreprocessResponse(BaseModel):
|
|||||||
fields = {}
|
fields = {}
|
||||||
for key, metadata in opts.data_labels.items():
|
for key, metadata in opts.data_labels.items():
|
||||||
value = opts.data.get(key)
|
value = opts.data.get(key)
|
||||||
|
if key == 'sd_model_checkpoint':
|
||||||
|
value = None
|
||||||
optType = opts.typemap.get(type(metadata.default), type(value))
|
optType = opts.typemap.get(type(metadata.default), type(value))
|
||||||
|
|
||||||
if (metadata is not None):
|
if optType == types.NoneType:
|
||||||
fields.update({key: (Optional[optType], Field(
|
pass
|
||||||
default=metadata.default ,description=metadata.label))})
|
elif metadata is not None:
|
||||||
|
fields.update({key: (Optional[optType], Field(default=metadata.default, description=metadata.label))})
|
||||||
else:
|
else:
|
||||||
fields.update({key: (Optional[optType], Field())})
|
fields.update({key: (Optional[optType], Field())})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user