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
353c8761
Commit
353c8761
authored
Aug 14, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix API always using -1 as seed
parent
f3b96d49
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
6 deletions
+16
-6
modules/api/api.py
modules/api/api.py
+2
-0
modules/processing.py
modules/processing.py
+3
-1
modules/processing_scripts/refiner.py
modules/processing_scripts/refiner.py
+1
-1
modules/processing_scripts/seed.py
modules/processing_scripts/seed.py
+1
-1
modules/scripts.py
modules/scripts.py
+9
-3
No files found.
modules/api/api.py
View file @
353c8761
...
...
@@ -330,6 +330,7 @@ class Api:
with
self
.
queue_lock
:
with
closing
(
StableDiffusionProcessingTxt2Img
(
sd_model
=
shared
.
sd_model
,
**
args
))
as
p
:
p
.
is_api
=
True
p
.
scripts
=
script_runner
p
.
outpath_grids
=
opts
.
outdir_txt2img_grids
p
.
outpath_samples
=
opts
.
outdir_txt2img_samples
...
...
@@ -390,6 +391,7 @@ class Api:
with
self
.
queue_lock
:
with
closing
(
StableDiffusionProcessingImg2Img
(
sd_model
=
shared
.
sd_model
,
**
args
))
as
p
:
p
.
init_images
=
[
decode_base64_to_image
(
x
)
for
x
in
init_images
]
p
.
is_api
=
True
p
.
scripts
=
script_runner
p
.
outpath_grids
=
opts
.
outdir_img2img_grids
p
.
outpath_samples
=
opts
.
outdir_img2img_samples
...
...
modules/processing.py
View file @
353c8761
...
...
@@ -194,6 +194,8 @@ class StableDiffusionProcessing:
sd_vae_name
:
str
=
field
(
default
=
None
,
init
=
False
)
sd_vae_hash
:
str
=
field
(
default
=
None
,
init
=
False
)
is_api
:
bool
=
field
(
default
=
False
,
init
=
False
)
def
__post_init__
(
self
):
if
self
.
sampler_index
is
not
None
:
print
(
"sampler_index argument for StableDiffusionProcessing does not do anything; use sampler_name"
,
file
=
sys
.
stderr
)
...
...
@@ -258,7 +260,7 @@ class StableDiffusionProcessing:
def
setup_scripts
(
self
):
self
.
scripts_setup_complete
=
True
self
.
scripts
.
setup_scrips
(
self
)
self
.
scripts
.
setup_scrips
(
self
,
is_ui
=
not
self
.
is_api
)
def
comment
(
self
,
text
):
self
.
comments
[
text
]
=
1
...
...
modules/processing_scripts/refiner.py
View file @
353c8761
...
...
@@ -5,7 +5,7 @@ from modules.ui_common import create_refresh_button
from
modules.ui_components
import
InputAccordion
class
ScriptRefiner
(
scripts
.
Script
):
class
ScriptRefiner
(
scripts
.
Script
BuiltinUI
):
section
=
"accordions"
create_group
=
False
...
...
modules/processing_scripts/seed.py
View file @
353c8761
...
...
@@ -7,7 +7,7 @@ from modules.shared import cmd_opts
from
modules.ui_components
import
ToolButton
class
ScriptSeed
(
scripts
.
ScriptBuiltin
):
class
ScriptSeed
(
scripts
.
ScriptBuiltin
UI
):
section
=
"seed"
create_group
=
False
...
...
modules/scripts.py
View file @
353c8761
...
...
@@ -68,6 +68,9 @@ class Script:
on_after_component_elem_id
=
None
"""list of callbacks to be called after a component with an elem_id is created"""
setup_for_ui_only
=
False
"""If true, the script setup will only be run in Gradio UI, not in API"""
def
title
(
self
):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""
...
...
@@ -258,7 +261,6 @@ class Script:
self
.
on_after_component_elem_id
.
append
((
elem_id
,
callback
))
def
describe
(
self
):
"""unused"""
return
""
...
...
@@ -280,7 +282,8 @@ class Script:
pass
class
ScriptBuiltin
(
Script
):
class
ScriptBuiltinUI
(
Script
):
setup_for_ui_only
=
True
def
elem_id
(
self
,
item_id
):
"""helper function to generate id for a HTML element, constructs final id out of tab and user-supplied item_id"""
...
...
@@ -728,8 +731,11 @@ class ScriptRunner:
except
Exception
:
errors
.
report
(
f
"Error running before_hr: {script.filename}"
,
exc_info
=
True
)
def
setup_scrips
(
self
,
p
):
def
setup_scrips
(
self
,
p
,
*
,
is_ui
=
True
):
for
script
in
self
.
alwayson_scripts
:
if
not
is_ui
and
script
.
setup_for_ui_only
:
continue
try
:
script_args
=
p
.
script_args
[
script
.
args_from
:
script
.
args_to
]
script
.
setup
(
p
,
*
script_args
)
...
...
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