def preprocess(
        self, payload: AnnotatedImageData | None
    ) -> tuple[str, list[tuple[str, str]]] | None:
        """
        Parameters:
            payload: Dict of base image and list of annotations.
        Returns:
            Passes its value as a `tuple` consisting of a `str` filepath to a base image and `list` of annotations. Each annotation itself is `tuple` of a mask (as a `str` filepath to image) and a `str` label.
        """
        if payload is None:
            return None
        base_img = payload.image.path
        annotations = [(a.image.path, a.label) for a in payload.annotations]
        return (base_img, annotations)

        Parameters:
            payload: Dict of base image and list of annotations.
        Returns:
            Passes its value as a `tuple` consisting of a `str` filepath to a base image and `list` of annotations. Each annotation itself is `tuple` of a mask (as a `str` filepath to image) and a `str` label.
        
gradio/components/annotated_image.py