def add_image(self, image: np.ndarray | Figure, name: str | None = None, **kwargs) -> None:
        """Log an image to Comet.

        Args:
            image: Image to log, either numpy array or matplotlib figure.
            name: Name/tag for the image.
                Defaults to ``None``.
            **kwargs: Must contain ``global_step`` (int) indicating the step at
                which to log the image.

        Raises:
            ValueError: If ``global_step`` not provided in kwargs.

        Example:
            >>> import numpy as np
            >>> from matplotlib.figure import Figure
            >>> logger = AnomalibCometLogger()  # doctest: +SKIP
            >>> # Log numpy array
            >>> image_array = np.random.rand(32, 32, 3)  # doctest: +SKIP
            >>> logger.add_image(
            ...     image=image_array,
            ...     name="test_image",
            ...     global_step=0
            ... )  # doctest: +SKIP
            >>> # Log matplotlib figure
            >>> fig = Figure()  # doctest: +SKIP
            >>> logger.add_image(
            ...     image=fig,
            ...     name="test_figure",
            ...     global_step=1
            ... )  # doctest: +SKIP
        """
        if "global_step" not in kwargs:
            msg = "`global_step` is required for comet logger"
            raise ValueError(msg)

        global_step = kwargs["global_step"]
        # Need to call different functions of `Experiment` for  Figure vs np.ndarray

        if isinstance(image, Figure):
            self.experiment.log_figure(figure_name=name, figure=image, step=global_step)
        else:
            self.experiment.log_image(name=name, image_data=image, step=global_step)
Log an image to Comet.

        Args:
            image: Image to log, either numpy array or matplotlib figure.
            name: Name/tag for the image.
                Defaults to ``None``.
            **kwargs: Must contain ``global_step`` (int) indicating the step at
                which to log the image.

        Raises:
            ValueError: If ``global_step`` not provided in kwargs.

        Example:
            >>> import numpy as np
            >>> from matplotlib.figure import Figure
            >>> logger = AnomalibCometLogger()  # doctest: +SKIP
            >>> # Log numpy array
            >>> image_array = np.random.rand(32, 32, 3)  # doctest: +SKIP
            >>> logger.add_image(
            ...     image=image_array,
            ...     name="test_image",
            ...     global_step=0
            ... )  # doctest: +SKIP
            >>> # Log matplotlib figure
            >>> fig = Figure()  # doctest: +SKIP
            >>> logger.add_image(
            ...     image=fig,
            ...     name="test_figure",
            ...     global_step=1
            ... )  # doctest: +SKIP
        
src/anomalib/loggers/comet.py