@@ -96,6 +96,7 @@ def title(self):
96
96
97
97
def ui (self , is_img2img ):
98
98
checkbox_iterate = gr .Checkbox (label = "Iterate seed every line" , value = False )
99
+ checkbox_iterate_batch = gr .Checkbox (label = "Preserve random seed across lines (for use with \" Generate Forever\" )" , value = False )
99
100
100
101
prompt_txt = gr .Textbox (label = "List of prompt inputs" , lines = 1 )
101
102
file = gr .File (label = "Upload prompt inputs" , type = 'bytes' )
@@ -106,9 +107,9 @@ def ui(self, is_img2img):
106
107
# We don't shrink back to 1, because that causes the control to ignore [enter], and it may
107
108
# be unclear to the user that shift-enter is needed.
108
109
prompt_txt .change (lambda tb : gr .update (lines = 7 ) if ("\n " in tb ) else gr .update (lines = 2 ), inputs = [prompt_txt ], outputs = [prompt_txt ])
109
- return [checkbox_iterate , file , prompt_txt ]
110
+ return [checkbox_iterate , checkbox_iterate_batch , file , prompt_txt ]
110
111
111
- def run (self , p , checkbox_iterate , file , prompt_txt : str ):
112
+ def run (self , p , checkbox_iterate , checkbox_iterate_batch , file , prompt_txt : str ):
112
113
lines = [x .strip () for x in prompt_txt .splitlines ()]
113
114
lines = [x for x in lines if len (x ) > 0 ]
114
115
@@ -137,7 +138,7 @@ def run(self, p, checkbox_iterate, file, prompt_txt: str):
137
138
jobs .append (args )
138
139
139
140
print (f"Will process { len (lines )} lines in { job_count } jobs." )
140
- if (checkbox_iterate and p .seed == - 1 ):
141
+ if (( checkbox_iterate or checkbox_iterate_batch ) and p .seed == - 1 ):
141
142
p .seed = int (random .randrange (4294967294 ))
142
143
143
144
state .job_count = job_count
0 commit comments