Spaces:
Running
Running
Update app.py
Browse files
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
|
250 |
if len(row_data) != max_num_columns:
|
251 |
row_data = row_data + ["" for _ in range(max_num_columns - len(row_data))]
|
252 |
-
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:
|