mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-10 06:10:50 +08:00
gracefully handle skia import failure
This commit is contained in:
parent
fd5449c5b7
commit
5727217c2f
@ -238,7 +238,7 @@ class PaligemmaOutputToMask(CustomNode):
|
||||
def execute(self, paligemma_output: PostProcessResult) -> tuple[MaskBatch]:
|
||||
masks = [torch.from_numpy(p["mask"]) for p in paligemma_output if "mask" in p]
|
||||
if len(masks) == 0:
|
||||
return torch.zeroes((0, 0, 0)),
|
||||
return torch.zeros((0, 0, 0)),
|
||||
return torch.stack(masks, dim=0),
|
||||
|
||||
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
import skia
|
||||
import torch
|
||||
import vtracer
|
||||
import logging
|
||||
from PIL import Image
|
||||
|
||||
from comfy.nodes.package_typing import CustomNode
|
||||
from comfy.utils import tensor2pil
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def RGB2RGBA(image: Image, mask: Image) -> Image:
|
||||
(R, G, B) = image.convert('RGB').split()
|
||||
@ -99,6 +101,11 @@ class SVGToImage(CustomNode):
|
||||
return svg_string[svg_start:]
|
||||
|
||||
def convert_to_image(self, svg, scale):
|
||||
try:
|
||||
import skia
|
||||
except (ImportError, ModuleNotFoundError) as exc_info:
|
||||
logger.error("failed to import skia", exc_info=exc_info)
|
||||
return (torch.zeros((0, 1, 1, 3)),)
|
||||
raster_images = []
|
||||
|
||||
for i, svg_string in enumerate(svg):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user