felix commited on
Commit
9e746c4
β€’
1 Parent(s): 044bf67
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -180,7 +180,13 @@ def display(x, y):
180
  original_df[column] = original_df[column].apply(remove_invalid_unicode)
181
 
182
  subset_df = original_df[COLS]
183
- output_file_path = 'output/output.json' # Adjust the path as needed
 
 
 
 
 
 
184
  with open(output_file_path, 'w') as file:
185
  file.write(subset_df.to_json(orient='records'))
186
  first_50_rows = subset_df.head(20)
 
180
  original_df[column] = original_df[column].apply(remove_invalid_unicode)
181
 
182
  subset_df = original_df[COLS]
183
+ # Ensure the output directory exists
184
+ output_dir = 'output'
185
+ if not os.path.exists(output_dir):
186
+ os.makedirs(output_dir)
187
+
188
+ # Save JSON to a file in the output directory
189
+ output_file_path = os.path.join(output_dir, 'output.json')
190
  with open(output_file_path, 'w') as file:
191
  file.write(subset_df.to_json(orient='records'))
192
  first_50_rows = subset_df.head(20)