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
0b83f4c2
Commit
0b83f4c2
authored
Jan 13, 2024
by
w-e-w
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reuse seed from infotexts
parent
cb5b335a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
modules/processing_scripts/seed.py
modules/processing_scripts/seed.py
+6
-13
No files found.
modules/processing_scripts/seed.py
View file @
0b83f4c2
...
...
@@ -6,6 +6,7 @@ from modules import scripts, ui, errors
from
modules.infotext_utils
import
PasteField
from
modules.shared
import
cmd_opts
from
modules.ui_components
import
ToolButton
from
modules
import
infotext_utils
class
ScriptSeed
(
scripts
.
ScriptBuiltinUI
):
...
...
@@ -77,7 +78,6 @@ class ScriptSeed(scripts.ScriptBuiltinUI):
p
.
seed_resize_from_h
=
seed_resize_from_h
def
connect_reuse_seed
(
seed
:
gr
.
Number
,
reuse_seed
:
gr
.
Button
,
generation_info
:
gr
.
Textbox
,
is_subseed
):
""" Connects a 'reuse (sub)seed' button's click event so that it copies last used
(sub)seed value from generation info the to the seed field. If copying subseed and subseed strength
...
...
@@ -85,21 +85,14 @@ def connect_reuse_seed(seed: gr.Number, reuse_seed: gr.Button, generation_info:
def
copy_seed
(
gen_info_string
:
str
,
index
):
res
=
-
1
try
:
gen_info
=
json
.
loads
(
gen_info_string
)
index
-=
gen_info
.
get
(
'index_of_first_image'
,
0
)
if
is_subseed
and
gen_info
.
get
(
'subseed_strength'
,
0
)
>
0
:
all_subseeds
=
gen_info
.
get
(
'all_subseeds'
,
[
-
1
])
res
=
all_subseeds
[
index
if
0
<=
index
<
len
(
all_subseeds
)
else
0
]
else
:
all_seeds
=
gen_info
.
get
(
'all_seeds'
,
[
-
1
])
res
=
all_seeds
[
index
if
0
<=
index
<
len
(
all_seeds
)
else
0
]
except
json
.
decoder
.
JSONDecodeError
:
infotext
=
gen_info
.
get
(
'infotexts'
)[
index
]
gen_parameters
=
infotext_utils
.
parse_generation_parameters
(
infotext
)
res
=
int
(
gen_parameters
.
get
(
'Variation seed'
if
is_subseed
else
'Seed'
,
-
1
))
except
Exception
:
if
gen_info_string
:
errors
.
report
(
f
"Error
parsing JSON generation info: {gen_info_string}"
)
errors
.
report
(
f
"Error
retrieving seed from generation info: {gen_info_string}"
,
exc_info
=
True
)
return
[
res
,
gr
.
update
()]
...
...
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