1
1
import inspect
2
2
from pydantic import BaseModel , Field , create_model
3
- from typing import Any , Optional , Union
3
+ from typing import Any , Optional
4
4
from typing_extensions import Literal
5
5
from inflection import underscore
6
6
from modules .processing import StableDiffusionProcessingTxt2Img , StableDiffusionProcessingImg2Img
@@ -185,22 +185,22 @@ class ProgressResponse(BaseModel):
185
185
for key in _options :
186
186
if (_options [key ].dest != 'help' ):
187
187
flag = _options [key ]
188
- _type = str
189
- if ( _options [key ].default != None ) : _type = type (_options [key ].default )
188
+ _type = str
189
+ if _options [key ].default is not None : _type = type (_options [key ].default )
190
190
flags .update ({flag .dest : (_type ,Field (default = flag .default , description = flag .help ))})
191
191
192
192
FlagsModel = create_model ("Flags" , ** flags )
193
193
194
194
class SamplerItem (BaseModel ):
195
195
name : str = Field (title = "Name" )
196
- aliases : list [str ] = Field (title = "Aliases" )
196
+ aliases : list [str ] = Field (title = "Aliases" )
197
197
options : dict [str , str ] = Field (title = "Options" )
198
198
199
199
class UpscalerItem (BaseModel ):
200
200
name : str = Field (title = "Name" )
201
- model_name : str | None = Field (title = "Model Name" )
202
- model_path : str | None = Field (title = "Path" )
203
- model_url : str | None = Field (title = "URL" )
201
+ model_name : Optional [ str ] = Field (title = "Model Name" )
202
+ model_path : Optional [ str ] = Field (title = "Path" )
203
+ model_url : Optional [ str ] = Field (title = "URL" )
204
204
205
205
class SDModelItem (BaseModel ):
206
206
title : str = Field (title = "Title" )
@@ -211,21 +211,21 @@ class SDModelItem(BaseModel):
211
211
212
212
class HypernetworkItem (BaseModel ):
213
213
name : str = Field (title = "Name" )
214
- path : str | None = Field (title = "Path" )
214
+ path : Optional [ str ] = Field (title = "Path" )
215
215
216
216
class FaceRestorerItem (BaseModel ):
217
217
name : str = Field (title = "Name" )
218
- cmd_dir : str | None = Field (title = "Path" )
218
+ cmd_dir : Optional [ str ] = Field (title = "Path" )
219
219
220
220
class RealesrganItem (BaseModel ):
221
221
name : str = Field (title = "Name" )
222
- path : str | None = Field (title = "Path" )
223
- scale : int | None = Field (title = "Scale" )
222
+ path : Optional [ str ] = Field (title = "Path" )
223
+ scale : Optional [ int ] = Field (title = "Scale" )
224
224
225
225
class PromptStyleItem (BaseModel ):
226
226
name : str = Field (title = "Name" )
227
- prompt : str | None = Field (title = "Prompt" )
228
- negative_prompt : str | None = Field (title = "Negative Prompt" )
227
+ prompt : Optional [ str ] = Field (title = "Prompt" )
228
+ negative_prompt : Optional [ str ] = Field (title = "Negative Prompt" )
229
229
230
230
class ArtistItem (BaseModel ):
231
231
name : str = Field (title = "Name" )
0 commit comments