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
315bd7c9
Commit
315bd7c9
authored
Nov 01, 2022
by
Keith Dreibelbis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prompts_from_file: allow random seeds to be preserved for the list of prompts
parent
2192b64c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
scripts/prompts_from_file.py
scripts/prompts_from_file.py
+4
-3
No files found.
scripts/prompts_from_file.py
View file @
315bd7c9
...
...
@@ -96,6 +96,7 @@ class Script(scripts.Script):
def
ui
(
self
,
is_img2img
):
checkbox_iterate
=
gr
.
Checkbox
(
label
=
"Iterate seed every line"
,
value
=
False
)
checkbox_iterate_batch
=
gr
.
Checkbox
(
label
=
"Preserve random seed across lines (for use with
\"
Generate Forever
\"
)"
,
value
=
False
)
prompt_txt
=
gr
.
Textbox
(
label
=
"List of prompt inputs"
,
lines
=
1
)
file
=
gr
.
File
(
label
=
"Upload prompt inputs"
,
type
=
'bytes'
)
...
...
@@ -106,9 +107,9 @@ class Script(scripts.Script):
# We don't shrink back to 1, because that causes the control to ignore [enter], and it may
# be unclear to the user that shift-enter is needed.
prompt_txt
.
change
(
lambda
tb
:
gr
.
update
(
lines
=
7
)
if
(
"
\n
"
in
tb
)
else
gr
.
update
(
lines
=
2
),
inputs
=
[
prompt_txt
],
outputs
=
[
prompt_txt
])
return
[
checkbox_iterate
,
file
,
prompt_txt
]
return
[
checkbox_iterate
,
checkbox_iterate_batch
,
file
,
prompt_txt
]
def
run
(
self
,
p
,
checkbox_iterate
,
file
,
prompt_txt
:
str
):
def
run
(
self
,
p
,
checkbox_iterate
,
checkbox_iterate_batch
,
file
,
prompt_txt
:
str
):
lines
=
[
x
.
strip
()
for
x
in
prompt_txt
.
splitlines
()]
lines
=
[
x
for
x
in
lines
if
len
(
x
)
>
0
]
...
...
@@ -137,7 +138,7 @@ class Script(scripts.Script):
jobs
.
append
(
args
)
print
(
f
"Will process {len(lines)} lines in {job_count} jobs."
)
if
(
checkbox_iterate
and
p
.
seed
==
-
1
):
if
(
(
checkbox_iterate
or
checkbox_iterate_batch
)
and
p
.
seed
==
-
1
):
p
.
seed
=
int
(
random
.
randrange
(
4294967294
))
state
.
job_count
=
job_count
...
...
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