Datasets:

toniwuest commited on
Commit
fbb59b7
·
verified ·
1 Parent(s): 273a779

Update CLEVR-Sudoku.py

Browse files
Files changed (1) hide show
  1. 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
- # Read and parse the JSON content
165
- json_content = json.load(file_path)
 
166
 
167
  # Extract the specific fields from the JSON
168
  extracted_data = {
169
- "file_name": file_name, # The name of the file inside the archive
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