CAMEO / README.md
allietran's picture
Update README.md
32bc000 verified
metadata
license: cc-by-sa-4.0
language:
  - vi
size_categories:
  - 100K<n<1M
configs:
  - config_name: products
    data_files:
      - split: test
        path:
          - products.parquet
    features:
      - name: product_id
        dtype: string
      - name: shop_id
        dtype: string
      - name: brand
        dtype: string
      - name: image_path
        dtype: string
      - name: price
        dtype: int64
      - name: processed_description
        dtype: string
      - name: product_name
        dtype: string
      - name: translated_brand
        dtype: string
      - name: translated_description
        dtype: string
      - name: translated_name
        dtype: string
  - config_name: reviews
    data_files:
      - split: test
        path: reviews.parquet
tags:
  - tabular

Script to download and use the dataset:

from datasets import load_dataset
from huggingface_hub import hf_hub_download
import os
from zipfile import ZipFile
from PIL import Image

# 1. Load products and reviews datasets
products = load_dataset("allietran/CAMEO", "products", split="test")
reviews = load_dataset("allietran/CAMEO", "reviews", split="test")

# 2. Download the images
zip_path = hf_hub_download(repo_id="allietran/CAMEO", filename="images.zip", repo_type="dataset")

# 3. Extract images to a local folder
extract_path = "./images"
with ZipFile(zip_path, 'r') as zip_ref:
    zip_ref.extractall(extract_path)

# 4. Access a row
sample = products[0]
relative_path = sample["image_path"]

# 5. Open the image manually
full_path = os.path.join(extract_path, relative_path)

if os.path.exists(full_path):
    img = Image.open(full_path)
    img.show()
else:
    print(f"File not found at: {full_path}")