Update characters.py
Browse files- characters.py +14 -1
characters.py
CHANGED
|
@@ -26,6 +26,19 @@ _DESCRIPTION = "Dream!n character datasets"
|
|
| 26 |
|
| 27 |
_DATASET_URL = "https://huggingface.co/datasets/JAWCF/characters/resolve/main/images.tar.gz"
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
class Characters(datasets.GeneratorBasedBuilder):
|
| 31 |
|
|
@@ -67,6 +80,6 @@ class Characters(datasets.GeneratorBasedBuilder):
|
|
| 67 |
for filepath, image in images:
|
| 68 |
yield idx, {
|
| 69 |
"image": {"path": filepath, "bytes": image.read()},
|
| 70 |
-
"text" : filepath,
|
| 71 |
}
|
| 72 |
idx+=1
|
|
|
|
| 26 |
|
| 27 |
_DATASET_URL = "https://huggingface.co/datasets/JAWCF/characters/resolve/main/images.tar.gz"
|
| 28 |
|
| 29 |
+
DICT_DESC = {
|
| 30 |
+
"./images/apprentice.png": "An apprentice from Star Wars who has white markers on face and a tribe hat",
|
| 31 |
+
"./images/bounty.PNG": "A bounty hunter from Star Wars who wears green armor",
|
| 32 |
+
"./images/harry.PNG": "Harry Potter from Harry Potter",
|
| 33 |
+
"./images/hermione.PNG": "Hermione Granger from Harry Potter",
|
| 34 |
+
"./images/jawa.PNG": "A Jawa from Star Wars",
|
| 35 |
+
"./images/malfoy.PNG" : "Draco Malfoy from Harry Potter",
|
| 36 |
+
"./images/mandalorian.png" : "A Mandalorian from Star Wars",
|
| 37 |
+
"./images/moaning.PNG" : "Moaning Myrtle from Harry Potter",
|
| 38 |
+
"./images/neville.PNG" : "A male Hogwarts student who has medium length black hair",
|
| 39 |
+
"./images/slytherin.PNG": "A Slytherin student who is wearing a hat and has gray hair",
|
| 40 |
+
"./images/snape.PNG": "Professor Snape from Harry Potter"
|
| 41 |
+
}
|
| 42 |
|
| 43 |
class Characters(datasets.GeneratorBasedBuilder):
|
| 44 |
|
|
|
|
| 80 |
for filepath, image in images:
|
| 81 |
yield idx, {
|
| 82 |
"image": {"path": filepath, "bytes": image.read()},
|
| 83 |
+
"text" : DICT_DESC[filepath],
|
| 84 |
}
|
| 85 |
idx+=1
|