mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-19 02:40:15 +08:00
Handle batches correctly
This commit is contained in:
parent
c33a948fa7
commit
4e3e46a323
16
nodes.py
16
nodes.py
@ -846,10 +846,14 @@ class ESRGAN:
|
|||||||
model_path = self.get_path(model=model),
|
model_path = self.get_path(model=model),
|
||||||
model = net
|
model = net
|
||||||
)
|
)
|
||||||
if face_restore is not None:
|
outputs = []
|
||||||
return face_restore(image, upsampler, scale)
|
for img in image:
|
||||||
res, _ = upsampler.enhance(255. * image[0].numpy(), outscale = scale)
|
if face_restore is not None:
|
||||||
return (torch.from_numpy(res.astype(np.float32) / 255.0)[None,],)
|
res = face_restore(255. * img.numpy(), upsampler, scale)
|
||||||
|
else:
|
||||||
|
res, _ = upsampler.enhance(255. * img.numpy(), outscale = scale)
|
||||||
|
outputs.append(torch.from_numpy(res.astype(np.float32) / 255.0))
|
||||||
|
return (outputs,)
|
||||||
|
|
||||||
def get_net(self, model):
|
def get_net(self, model):
|
||||||
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
|
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
|
||||||
@ -905,8 +909,8 @@ class GFPGAN:
|
|||||||
channel_multiplier=2,
|
channel_multiplier=2,
|
||||||
bg_upsampler=upscaler,
|
bg_upsampler=upscaler,
|
||||||
)
|
)
|
||||||
_, _, res = enhancer.enhance(255. * image[0].numpy(), paste_back=True, weight=weight)
|
_, _, res = enhancer.enhance(image, paste_back=True, weight=weight)
|
||||||
return (torch.from_numpy(res.astype(np.float32) / 255.0)[None,],)
|
return res
|
||||||
|
|
||||||
class ImageInvert:
|
class ImageInvert:
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user