def upload_data(self, samples, dataset_name, media_field="filepath"):
        """Uploads the media for the given samples to Labelbox.

        This method uses ``labelbox.schema.dataset.Dataset.create_data_rows()``
        to add data in batches, and sets the global key of each DataRow to the
        ID of the corresponding sample.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
                containing the media to upload
            dataset_name: the name of the Labelbox dataset created if data
                needs to be uploaded
            media_field ("filepath"): string field name containing the paths to
                media files on disk to upload
        """
        media_paths, sample_ids = samples.values([media_field, "id"])
        media_paths, sample_ids = self._skip_existing_global_keys(
            media_paths, sample_ids
        )

        upload_info = []

        with fou.ProgressBar(iters_str="samples") as pb:
            for media_path, sample_id in pb(zip(media_paths, sample_ids)):
                item_url = self._client.upload_file(media_path)
                upload_info.append(
                    {
                        lb.DataRow.row_data: item_url,
                        lb.DataRow.global_key: sample_id,
                    }
                )

        if upload_info:
            lb_dataset = self._client.create_dataset(name=dataset_name)
            task = lb_dataset.create_data_rows(upload_info)
            task.wait_till_done()
            if task.errors:
                logger.warning(
                    "Datarow creation failed with error: %s" % task.errors
                )
Uploads the media for the given samples to Labelbox.

        This method uses ``labelbox.schema.dataset.Dataset.create_data_rows()``
        to add data in batches, and sets the global key of each DataRow to the
        ID of the corresponding sample.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
                containing the media to upload
            dataset_name: the name of the Labelbox dataset created if data
                needs to be uploaded
            media_field ("filepath"): string field name containing the paths to
                media files on disk to upload
        
fiftyone/utils/labelbox.py