Datasets:

toniwuest commited on
Commit
30ea15c
·
verified ·
1 Parent(s): fbb59b7

Update CLEVR-Sudoku.py

Browse files
Files changed (1) hide show
  1. CLEVR-Sudoku.py +4 -4
CLEVR-Sudoku.py CHANGED
@@ -157,17 +157,17 @@ class CLEVRSudoku(datasets.GeneratorBasedBuilder):
157
  json_files = os.listdir(json_dir)
158
  print(json_files)
159
 
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
 
157
  json_files = os.listdir(json_dir)
158
  print(json_files)
159
 
160
+ for i, file_name in enumerate(json_files):
161
 
162
+ print(i, file_name)
163
 
164
+ with open(os.path.join(archive_path, top_dir, "json", file_name), '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_name, # 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