Use local import for Rembg

Rembg can sometimes cause *very* long load times on import (like 40s). Moving it to local doesn't fix the long import entirely, but it does prevent it causing ComfyUI from loading slowly.
This commit is contained in:
d8ahazard
2024-12-03 04:55:55 +01:00
committed by Mel Massadian
parent ecbb220de6
commit 64634104a2
+2 -1
View File
@@ -1,6 +1,5 @@
import comfy.utils
from PIL import Image
from rembg import remove
from ..utils import pil2tensor, tensor2pil
@@ -64,6 +63,8 @@ class MTB_ImageRemoveBackgroundRembg:
post_process_mask,
bgcolor,
):
from rembg import remove
pbar = comfy.utils.ProgressBar(image.size(0))
images = tensor2pil(image)