nielsr HF staff commited on
Commit
43f615c
1 Parent(s): 11608ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -242,14 +242,14 @@ def apply_ocr(cell_coordinates, cropped_table):
242
  if len(row_text) > max_num_columns:
243
  max_num_columns = len(row_text)
244
 
245
- data[idx] = row_text
246
 
247
  # pad rows which don't have max_num_columns elements
248
  # to make sure all rows have the same number of columns
249
- for row, row_data in data.copy().items():
250
  if len(row_data) != max_num_columns:
251
  row_data = row_data + ["" for _ in range(max_num_columns - len(row_data))]
252
- data[row] = row_data
253
 
254
  # write to csv
255
  with open('output.csv','w') as result_file:
 
242
  if len(row_text) > max_num_columns:
243
  max_num_columns = len(row_text)
244
 
245
+ data[str(idx)] = row_text
246
 
247
  # pad rows which don't have max_num_columns elements
248
  # to make sure all rows have the same number of columns
249
+ for idx, row_data in data.copy().items():
250
  if len(row_data) != max_num_columns:
251
  row_data = row_data + ["" for _ in range(max_num_columns - len(row_data))]
252
+ data[str(idx)] = row_data
253
 
254
  # write to csv
255
  with open('output.csv','w') as result_file: