re-fix esrgan/gfpgan multiple images bug

Must have been undone by some pr

also, grid is now only appended to output images if more than 1 images is being generated
This commit is contained in:
hlky 2022-08-28 22:12:59 +01:00
parent fbd4878551
commit 8d15f865e9
No known key found for this signature in database
GPG Key ID: 55A99F1E80D907D5

View File

@ -793,7 +793,7 @@ def process_images(
x_sample = x_sample.astype(np.uint8)
original_sample = x_sample
original_filename = filename
if use_GFPGAN and GFPGAN is not None:
if use_GFPGAN and GFPGAN is not None and not use_RealESRGAN:
torch_gc()
cropped_faces, restored_faces, restored_img = GFPGAN.enhance(x_sample[:,:,::-1], has_aligned=False, only_center_face=False, paste_back=True)
gfpgan_sample = restored_img[:,:,::-1]
@ -874,7 +874,7 @@ skip_grid, sort_samples, sampler_name, ddim_eta, n_iter, batch_size, i, denoisin
else:
grid = image_grid(output_images, batch_size)
if grid:
if grid and (batch_size > 1 or n_iter > 1):
output_images.insert(0, grid)
grid_count = get_next_sequence_number(outpath, 'grid-')