Update test3.py
Browse files
test3.py
CHANGED
|
@@ -41,6 +41,7 @@ Artwork Images, to predict the year of the artwork created.
|
|
| 41 |
|
| 42 |
_URL = "https://huggingface.co/datasets/AIPI540/Art2/resolve/main/final_art_data.parquet"
|
| 43 |
|
|
|
|
| 44 |
|
| 45 |
class Artwork(datasets.GeneratorBasedBuilder):
|
| 46 |
"""Artwork Images - a dataset of centuries of Images classes"""
|
|
@@ -50,7 +51,7 @@ class Artwork(datasets.GeneratorBasedBuilder):
|
|
| 50 |
description=_DESCRIPTION,
|
| 51 |
features=datasets.Features(
|
| 52 |
{
|
| 53 |
-
"label": datasets.features.ClassLabel(names=
|
| 54 |
"image_data": datasets.Value("binary"),
|
| 55 |
}
|
| 56 |
),
|
|
@@ -84,6 +85,6 @@ class Artwork(datasets.GeneratorBasedBuilder):
|
|
| 84 |
print(path.image_data)
|
| 85 |
print(type(path.image_data))
|
| 86 |
yield {
|
| 87 |
-
"label": str(path.label),
|
| 88 |
"image_data": path.image_data,
|
| 89 |
}
|
|
|
|
| 41 |
|
| 42 |
_URL = "https://huggingface.co/datasets/AIPI540/Art2/resolve/main/final_art_data.parquet"
|
| 43 |
|
| 44 |
+
classes=['0','1','2','3','4','5','6']
|
| 45 |
|
| 46 |
class Artwork(datasets.GeneratorBasedBuilder):
|
| 47 |
"""Artwork Images - a dataset of centuries of Images classes"""
|
|
|
|
| 51 |
description=_DESCRIPTION,
|
| 52 |
features=datasets.Features(
|
| 53 |
{
|
| 54 |
+
"label": datasets.features.ClassLabel(names=classes),
|
| 55 |
"image_data": datasets.Value("binary"),
|
| 56 |
}
|
| 57 |
),
|
|
|
|
| 85 |
print(path.image_data)
|
| 86 |
print(type(path.image_data))
|
| 87 |
yield {
|
| 88 |
+
"label": classes[str(path.label)],
|
| 89 |
"image_data": path.image_data,
|
| 90 |
}
|