Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
models.py
modules/api/models.py
+13
-13
No files found.
modules/api/models.py
View file @
ebce0c57
import
inspect
import
inspect
from
pydantic
import
BaseModel
,
Field
,
create_model
from
pydantic
import
BaseModel
,
Field
,
create_model
from
typing
import
Any
,
Optional
,
Union
from
typing
import
Any
,
Optional
from
typing_extensions
import
Literal
from
typing_extensions
import
Literal
from
inflection
import
underscore
from
inflection
import
underscore
from
modules.processing
import
StableDiffusionProcessingTxt2Img
,
StableDiffusionProcessingImg2Img
from
modules.processing
import
StableDiffusionProcessingTxt2Img
,
StableDiffusionProcessingImg2Img
...
@@ -185,22 +185,22 @@ _options = vars(parser)['_option_string_actions']
...
@@ -185,22 +185,22 @@ _options = vars(parser)['_option_string_actions']
for
key
in
_options
:
for
key
in
_options
:
if
(
_options
[
key
]
.
dest
!=
'help'
):
if
(
_options
[
key
]
.
dest
!=
'help'
):
flag
=
_options
[
key
]
flag
=
_options
[
key
]
_type
=
str
_type
=
str
if
(
_options
[
key
]
.
default
!=
None
):
_type
=
type
(
_options
[
key
]
.
default
)
if
_options
[
key
]
.
default
is
not
None
:
_type
=
type
(
_options
[
key
]
.
default
)
flags
.
update
({
flag
.
dest
:
(
_type
,
Field
(
default
=
flag
.
default
,
description
=
flag
.
help
))})
flags
.
update
({
flag
.
dest
:
(
_type
,
Field
(
default
=
flag
.
default
,
description
=
flag
.
help
))})
FlagsModel
=
create_model
(
"Flags"
,
**
flags
)
FlagsModel
=
create_model
(
"Flags"
,
**
flags
)
class
SamplerItem
(
BaseModel
):
class
SamplerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
aliases
:
list
[
str
]
=
Field
(
title
=
"Aliases"
)
aliases
:
list
[
str
]
=
Field
(
title
=
"Aliases"
)
options
:
dict
[
str
,
str
]
=
Field
(
title
=
"Options"
)
options
:
dict
[
str
,
str
]
=
Field
(
title
=
"Options"
)
class
UpscalerItem
(
BaseModel
):
class
UpscalerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
model_name
:
str
|
None
=
Field
(
title
=
"Model Name"
)
model_name
:
Optional
[
str
]
=
Field
(
title
=
"Model Name"
)
model_path
:
str
|
None
=
Field
(
title
=
"Path"
)
model_path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
model_url
:
str
|
None
=
Field
(
title
=
"URL"
)
model_url
:
Optional
[
str
]
=
Field
(
title
=
"URL"
)
class
SDModelItem
(
BaseModel
):
class
SDModelItem
(
BaseModel
):
title
:
str
=
Field
(
title
=
"Title"
)
title
:
str
=
Field
(
title
=
"Title"
)
...
@@ -211,21 +211,21 @@ class SDModelItem(BaseModel):
...
@@ -211,21 +211,21 @@ class SDModelItem(BaseModel):
class
HypernetworkItem
(
BaseModel
):
class
HypernetworkItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
path
:
str
|
None
=
Field
(
title
=
"Path"
)
path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
class
FaceRestorerItem
(
BaseModel
):
class
FaceRestorerItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
cmd_dir
:
str
|
None
=
Field
(
title
=
"Path"
)
cmd_dir
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
class
RealesrganItem
(
BaseModel
):
class
RealesrganItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
path
:
str
|
None
=
Field
(
title
=
"Path"
)
path
:
Optional
[
str
]
=
Field
(
title
=
"Path"
)
scale
:
int
|
None
=
Field
(
title
=
"Scale"
)
scale
:
Optional
[
int
]
=
Field
(
title
=
"Scale"
)
class
PromptStyleItem
(
BaseModel
):
class
PromptStyleItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
name
:
str
=
Field
(
title
=
"Name"
)
prompt
:
str
|
None
=
Field
(
title
=
"Prompt"
)
prompt
:
Optional
[
str
]
=
Field
(
title
=
"Prompt"
)
negative_prompt
:
str
|
None
=
Field
(
title
=
"Negative Prompt"
)
negative_prompt
:
Optional
[
str
]
=
Field
(
title
=
"Negative Prompt"
)
class
ArtistItem
(
BaseModel
):
class
ArtistItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
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