Update model.py
Browse files
model.py
CHANGED
@@ -9,7 +9,6 @@ import pandas as pd
|
|
9 |
|
10 |
from helper import *
|
11 |
|
12 |
-
reader = easyocr.Reader(['en']) # this needs to run only once to load the model into memory
|
13 |
|
14 |
model = AutoModelForObjectDetection.from_pretrained("microsoft/table-transformer-detection", revision="no_timm")
|
15 |
|
@@ -75,6 +74,7 @@ def inference(image):
|
|
75 |
cells = outputs_to_objects(outputs, cropped_table.size, structure_id2label)
|
76 |
|
77 |
cell_coordinates = get_cell_coordinates_by_row(cells)
|
|
|
78 |
|
79 |
data = apply_ocr(cell_coordinates, cropped_table, reader)
|
80 |
tf= pd.DataFrame(data).T
|
|
|
9 |
|
10 |
from helper import *
|
11 |
|
|
|
12 |
|
13 |
model = AutoModelForObjectDetection.from_pretrained("microsoft/table-transformer-detection", revision="no_timm")
|
14 |
|
|
|
74 |
cells = outputs_to_objects(outputs, cropped_table.size, structure_id2label)
|
75 |
|
76 |
cell_coordinates = get_cell_coordinates_by_row(cells)
|
77 |
+
reader = easyocr.Reader(['en']) # this needs to run only once to load the model into memory
|
78 |
|
79 |
data = apply_ocr(cell_coordinates, cropped_table, reader)
|
80 |
tf= pd.DataFrame(data).T
|