def _uncast_uris_as_images(hf_dataset: "HFDataset", columns: List[str]) -> "HFDataset":
    """Cast the image features in the Hugging Face dataset as PIL images.

    Parameters:
        hf_dataset (HFDataset): The Hugging Face dataset to cast.
        columns (List[str]): The names of the columns containing the image features.

    Returns:
        HFDataset: The Hugging Face dataset with image features cast as PIL images.
    """

    casted_hf_dataset = hf_dataset

    for column in columns:
        features = hf_dataset.features.copy()
        features[column] = Image()
        casted_hf_dataset = hf_dataset.map(
            function=lambda batch: {column: [uncast_image(sample) for sample in batch]},
            with_indices=False,
            batched=True,
            input_columns=[column],
            remove_columns=[column],
            features=features,
        )
        try:
            casted_hf_dataset[0]
        except FileNotFoundError:
            warnings.warn(
                f"Image file not found for column {column}. Image will be persisted as string (URL, path, or base64)."
            )
            casted_hf_dataset = hf_dataset

    return casted_hf_dataset
Cast the image features in the Hugging Face dataset as PIL images.

    Parameters:
        hf_dataset (HFDataset): The Hugging Face dataset to cast.
        columns (List[str]): The names of the columns containing the image features.

    Returns:
        HFDataset: The Hugging Face dataset with image features cast as PIL images.
    
argilla/src/argilla/records/_io/_datasets.py