Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
ebce0c57
Commit
ebce0c57
authored
Nov 05, 2022
by
Billy Cao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use typing.Optional instead of | to add support for Python 3.9 and below.
parent
30b1bcc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
modules/api/models.py
modules/api/models.py
+13
-13
No files found.
modules/api/models.py
View file @
ebce0c57
import
inspect
from
pydantic
import
BaseModel
,
Field
,
create_model
from
typing
import
Any
,
Optional
,
Union
from
typing
import
Any
,
Optional
from
typing_extensions
import
Literal
from
inflection
import
underscore
from
modules.processing
import
StableDiffusionProcessingTxt2Img
,
StableDiffusionProcessingImg2Img
...
...
@@ -185,22 +185,22 @@ _options = vars(parser)['_option_string_actions']
for
key
in
_options
:
if
(
_options
[
key
]
.
dest
!=
'help'
):
flag
=
_options
[
key
]
_type
=
str
if
(
_options
[
key
]
.
default
!=
None
):
_type
=
type
(
_options
[
key
]
.
default
)
_type
=
str
if
_options
[
key
]
.
default
is
not
None
:
_type
=
type
(
_options
[
key
]
.
default
)
flags
.
update
({
flag
.
dest
:
(
_type
,
Field
(
default
=
flag
.
default
,
description
=
flag
.
help
))})
FlagsModel
=
create_model
(
"Flags"
,
**
flags
)
class
SamplerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
aliases
:
list
[
str
]
=
Field
(
title
=
"Aliases"
)
aliases
:
list
[
str
]
=
Field
(
title
=
"Aliases"
)
options
:
dict
[
str
,
str
]
=
Field
(
title
=
"Options"
)
class
UpscalerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
model_name
:
str
|
None
=
Field
(
title
=
"Model Name"
)
model_path
:
str
|
None
=
Field
(
title
=
"Path"
)
model_url
:
str
|
None
=
Field
(
title
=
"URL"
)
model_name
:
Optional
[
str
]
=
Field
(
title
=
"Model Name"
)
model_path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
model_url
:
Optional
[
str
]
=
Field
(
title
=
"URL"
)
class
SDModelItem
(
BaseModel
):
title
:
str
=
Field
(
title
=
"Title"
)
...
...
@@ -211,21 +211,21 @@ class SDModelItem(BaseModel):
class
HypernetworkItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
path
:
str
|
None
=
Field
(
title
=
"Path"
)
path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
class
FaceRestorerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
cmd_dir
:
str
|
None
=
Field
(
title
=
"Path"
)
cmd_dir
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
class
RealesrganItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
path
:
str
|
None
=
Field
(
title
=
"Path"
)
scale
:
int
|
None
=
Field
(
title
=
"Scale"
)
path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
scale
:
Optional
[
int
]
=
Field
(
title
=
"Scale"
)
class
PromptStyleItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
prompt
:
str
|
None
=
Field
(
title
=
"Prompt"
)
negative_prompt
:
str
|
None
=
Field
(
title
=
"Negative Prompt"
)
prompt
:
Optional
[
str
]
=
Field
(
title
=
"Prompt"
)
negative_prompt
:
Optional
[
str
]
=
Field
(
title
=
"Negative Prompt"
)
class
ArtistItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment