File tree Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -178,15 +178,7 @@ def progressapi(self, req: ProgressRequest = Depends()):
178
178
179
179
progress = min (progress , 1 )
180
180
181
- # copy from check_progress_call of ui.py
182
-
183
- if shared .parallel_processing_allowed :
184
- if shared .state .sampling_step - shared .state .current_image_sampling_step >= shared .opts .show_progress_every_n_steps and shared .state .current_latent is not None :
185
- if shared .opts .show_progress_grid :
186
- shared .state .current_image = samples_to_image_grid (shared .state .current_latent )
187
- else :
188
- shared .state .current_image = sample_to_image (shared .state .current_latent )
189
- shared .state .current_image_sampling_step = shared .state .sampling_step
181
+ shared .state .set_current_image ()
190
182
191
183
current_image = None
192
184
if shared .state .current_image and not req .skip_current_image :
Original file line number Diff line number Diff line change @@ -184,6 +184,20 @@ def end(self):
184
184
185
185
devices .torch_gc ()
186
186
187
+ """sets self.current_image from self.current_latent if enough sampling steps have been made after the last call to this"""
188
+ def set_current_image (self ):
189
+ if not parallel_processing_allowed :
190
+ return
191
+
192
+ if self .sampling_step - self .current_image_sampling_step >= opts .show_progress_every_n_steps and self .current_latent is not None :
193
+ if opts .show_progress_grid :
194
+ self .current_image = sd_samplers .samples_to_image_grid (self .current_latent )
195
+ else :
196
+ self .current_image = sd_samplers .sample_to_image (self .current_latent )
197
+
198
+ self .current_image_sampling_step = self .sampling_step
199
+
200
+
187
201
state = State ()
188
202
189
203
artist_db = modules .artists .ArtistsDatabase (os .path .join (script_path , 'artists.csv' ))
Original file line number Diff line number Diff line change @@ -277,15 +277,7 @@ def check_progress_call(id_part):
277
277
preview_visibility = gr_show (False )
278
278
279
279
if opts .show_progress_every_n_steps > 0 :
280
- if shared .parallel_processing_allowed :
281
-
282
- if shared .state .sampling_step - shared .state .current_image_sampling_step >= opts .show_progress_every_n_steps and shared .state .current_latent is not None :
283
- if opts .show_progress_grid :
284
- shared .state .current_image = modules .sd_samplers .samples_to_image_grid (shared .state .current_latent )
285
- else :
286
- shared .state .current_image = modules .sd_samplers .sample_to_image (shared .state .current_latent )
287
- shared .state .current_image_sampling_step = shared .state .sampling_step
288
-
280
+ shared .state .set_current_image ()
289
281
image = shared .state .current_image
290
282
291
283
if image is None :
You can’t perform that action at this time.
0 commit comments