Update CLEVR-Sudoku.py
Browse files- CLEVR-Sudoku.py +5 -4
CLEVR-Sudoku.py
CHANGED
@@ -160,13 +160,14 @@ class CLEVRSudoku(datasets.GeneratorBasedBuilder):
|
|
160 |
for i, file_path in enumerate(json_files):
|
161 |
|
162 |
print(i, file_path)
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
166 |
|
167 |
# Extract the specific fields from the JSON
|
168 |
extracted_data = {
|
169 |
-
"file_name":
|
170 |
"id": i, # Extract the 'id' field
|
171 |
"name": json_content.get("name"), # Extract the 'name' field
|
172 |
"solution": json_content.get("solution") # Extract the 'puzzle' field
|
|
|
160 |
for i, file_path in enumerate(json_files):
|
161 |
|
162 |
print(i, file_path)
|
163 |
+
|
164 |
+
with open(file_path, 'r') as f:
|
165 |
+
# Read and parse the JSON content
|
166 |
+
json_content = json.load(f)
|
167 |
|
168 |
# Extract the specific fields from the JSON
|
169 |
extracted_data = {
|
170 |
+
"file_name": file_path, # The name of the file inside the archive
|
171 |
"id": i, # Extract the 'id' field
|
172 |
"name": json_content.get("name"), # Extract the 'name' field
|
173 |
"solution": json_content.get("solution") # Extract the 'puzzle' field
|