Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -256,15 +256,15 @@ def apply_ocr(cell_coordinates, cropped_table):
|
|
256 |
row_data = row_data + ["" for _ in range(max_num_columns - len(row_data))]
|
257 |
data[str(idx)] = row_data
|
258 |
|
259 |
-
#
|
260 |
-
|
261 |
-
|
262 |
|
263 |
-
|
264 |
-
|
265 |
|
266 |
-
#
|
267 |
-
|
268 |
|
269 |
return data
|
270 |
|
|
|
256 |
row_data = row_data + ["" for _ in range(max_num_columns - len(row_data))]
|
257 |
data[str(idx)] = row_data
|
258 |
|
259 |
+
# write to csv
|
260 |
+
with open('output.csv','w') as result_file:
|
261 |
+
wr = csv.writer(result_file, dialect='excel')
|
262 |
|
263 |
+
for row, row_text in data.items():
|
264 |
+
wr.writerow(row_text)
|
265 |
|
266 |
+
# return as Pandas dataframe
|
267 |
+
df = pd.read_csv('output.csv')
|
268 |
|
269 |
return data
|
270 |
|