File size: 1,627 Bytes
74d53e2
 
 
 
 
 
050b238
9a935fe
86176d9
 
 
a3bf7f8
 
4127df3
302a563
 
 
 
 
 
 
7b65acd
302a563
 
 
 
 
 
 
 
 
 
 
 
86176d9
 
dc3dafe
86176d9
050b238
4127df3
80fbb69
 
7cfed0c
 
 
 
 
 
32bc000
 
 
 
7cfed0c
32bc000
 
 
7cfed0c
32bc000
 
7cfed0c
32bc000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7cfed0c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
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:

```python
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}")
```