mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-23 17:38:10 +00:00
update ESRGAN
This commit is contained in:
@@ -107,6 +107,12 @@ class ESRGAN(torch.nn.Module):
|
|||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def upscale(self, images, batch_size=4, progress_bar=lambda x:x):
|
def upscale(self, images, batch_size=4, progress_bar=lambda x:x):
|
||||||
|
if not isinstance(images, list):
|
||||||
|
images = [images]
|
||||||
|
is_single_image = True
|
||||||
|
else:
|
||||||
|
is_single_image = False
|
||||||
|
|
||||||
# Preprocess
|
# Preprocess
|
||||||
input_tensor = self.process_images(images)
|
input_tensor = self.process_images(images)
|
||||||
|
|
||||||
@@ -126,4 +132,6 @@ class ESRGAN(torch.nn.Module):
|
|||||||
|
|
||||||
# To images
|
# To images
|
||||||
output_images = self.decode_images(output_tensor)
|
output_images = self.decode_images(output_tensor)
|
||||||
|
if is_single_image:
|
||||||
|
output_images = output_images[0]
|
||||||
return output_images
|
return output_images
|
||||||
|
|||||||
Reference in New Issue
Block a user