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 types
|
||||
|
||||
from pydantic import BaseModel, Field, create_model
|
||||
from typing import Any, Optional
|
||||
from typing_extensions import Literal
|
||||
@ -207,11 +209,14 @@ class PreprocessResponse(BaseModel):
|
||||
fields = {}
|
||||
for key, metadata in opts.data_labels.items():
|
||||
value = opts.data.get(key)
|
||||
if key == 'sd_model_checkpoint':
|
||||
value = None
|
||||
optType = opts.typemap.get(type(metadata.default), type(value))
|
||||
|
||||
if (metadata is not None):
|
||||
fields.update({key: (Optional[optType], Field(
|
||||
default=metadata.default ,description=metadata.label))})
|
||||
if optType == types.NoneType:
|
||||
pass
|
||||
elif metadata is not None:
|
||||
fields.update({key: (Optional[optType], Field(default=metadata.default, description=metadata.label))})
|
||||
else:
|
||||
fields.update({key: (Optional[optType], Field())})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user