# Uploading an csv file into HF

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuploading-an-csv-file-into-hf%2F157341%3E%5C
**Category:** Beginners\
**Created:** [May 30, 2025, 6:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuploading-an-csv-file-into-hf%2F157341 "2025-05-30T06:03:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [May 30, 2025, 6:55am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuploading-an-csv-file-into-hf%2F157341%2F2 "2025-05-30T06:55:56Z")

</div>

I think it’s better to download the data first, create a dataset that includes the actual images, and then upload it, as this reduces the risk of encountering download errors during training. However, either method should work. Additionally, there is an option to create a script for loading the dataset.

Ultimately, you need to decide whether to have the Trainer’s DataCollator download the data from the URL or to prepare the dataset in advance and use the datasets library.

> **[How to convert simple image url and text to dataset · huggingface datasets ·...](https://github.com/huggingface/datasets/discussions/5215)**
>
> Hi I wanna prepare a dataset, I created a csv like this "https://image1.jpg", "dog" "https://image2.jpg", "cat" "https://image3.jpg", "panda" or html

> **[Create a dataset loading script](https://huggingface.co/docs/datasets/en/dataset_script)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> [@How to run image classification on image url](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-run-image-classification-on-image-url%2F20604%2F5)%3A
>
> Yes you can probably map them all to Pillow images and then cast to the Image feature: from datasets import load\_dataset import requests from PIL import Image def to\_pillow(examples): urls = examples['Photo'] images = [] for url in urls: image = Image.open(requests.get(url, stream=True).raw) images.append(image) examples['image'] = images return examples dataset = load\_dataset("TheNoob3131/mosquito-data") dataset = dataset.map(to\_pillow, batched=True)…

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuploading-an-csv-file-into-hf%2F157341)._
