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

    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 URLs.
    """

    for column in columns:
        # make an updated features object with the new column type
        features = hf_dataset.features.copy()
        features[column] = Value("string")
        # cast the column in batches
        hf_dataset = hf_dataset.map(
            function=lambda batch: {column: [pil_to_data_uri(sample) for sample in batch]},
            with_indices=False,
            batched=True,
            input_columns=[column],
            remove_columns=[column],
            features=features,
        )

    return hf_dataset
Cast the image features in the Hugging Face dataset as URLs.

    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 URLs.
    
argilla/src/argilla/records/_io/_datasets.py