Spaces:
Runtime error
Runtime error
felix
commited on
Commit
·
9e746c4
1
Parent(s):
044bf67
fix
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|