yonatanbitton
commited on
Commit
•
092250a
1
Parent(s):
bf6dae8
Update winogavil.py
Browse files- winogavil.py +4 -4
winogavil.py
CHANGED
@@ -57,10 +57,10 @@ class Winogavil(datasets.GeneratorBasedBuilder):
|
|
57 |
img = datasets.Image()
|
58 |
features = datasets.Features(
|
59 |
{
|
60 |
-
"candidates": datasets.Value("string"),
|
61 |
"candidates_images": [img],
|
62 |
"cue": datasets.Value("string"),
|
63 |
-
"associations": datasets.Value("string"),
|
64 |
'score_fool_the_ai': datasets.Value("float64"),
|
65 |
'num_associations': datasets.Value("int64"),
|
66 |
'num_candidates': datasets.Value("int64"),
|
@@ -109,11 +109,11 @@ class Winogavil(datasets.GeneratorBasedBuilder):
|
|
109 |
for r_idx, r in df.iterrows():
|
110 |
r_dict = r.to_dict()
|
111 |
r_dict['candidates'] = json.loads(r_dict['candidates'])
|
112 |
-
candidates_images = [get_img_url(x) for x in r['candidates']
|
113 |
r['candidates_images'] = candidates_images
|
114 |
r_dict['associations'] = json.loads(r_dict['associations'])
|
115 |
key = r['ID']
|
116 |
-
yield key,
|
117 |
|
118 |
def get_img_url(image_name):
|
119 |
return 'https://winogavil.s3.eu-west-1.amazonaws.com/{}'.format(image_name + ".jpg")
|
|
|
57 |
img = datasets.Image()
|
58 |
features = datasets.Features(
|
59 |
{
|
60 |
+
"candidates": [datasets.Value("string")],
|
61 |
"candidates_images": [img],
|
62 |
"cue": datasets.Value("string"),
|
63 |
+
"associations": [datasets.Value("string")],
|
64 |
'score_fool_the_ai': datasets.Value("float64"),
|
65 |
'num_associations': datasets.Value("int64"),
|
66 |
'num_candidates': datasets.Value("int64"),
|
|
|
109 |
for r_idx, r in df.iterrows():
|
110 |
r_dict = r.to_dict()
|
111 |
r_dict['candidates'] = json.loads(r_dict['candidates'])
|
112 |
+
candidates_images = [get_img_url(x) for x in r['candidates'][
|
113 |
r['candidates_images'] = candidates_images
|
114 |
r_dict['associations'] = json.loads(r_dict['associations'])
|
115 |
key = r['ID']
|
116 |
+
yield key, r_dict
|
117 |
|
118 |
def get_img_url(image_name):
|
119 |
return 'https://winogavil.s3.eu-west-1.amazonaws.com/{}'.format(image_name + ".jpg")
|