Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,8 @@ from PIL import Image, ImageDraw
|
|
7 |
from transformers import TableTransformerImageProcessor, AutoModelForObjectDetection
|
8 |
import torch
|
9 |
|
|
|
|
|
10 |
import gradio as gr
|
11 |
|
12 |
# load table detection model
|
@@ -17,6 +19,9 @@ model = AutoModelForObjectDetection.from_pretrained("microsoft/table-transformer
|
|
17 |
structure_processor = TableTransformerImageProcessor(max_size=1000)
|
18 |
structure_model = AutoModelForObjectDetection.from_pretrained("microsoft/table-structure-recognition-v1.1-all")
|
19 |
|
|
|
|
|
|
|
20 |
|
21 |
# for output bounding box post-processing
|
22 |
def box_cxcywh_to_xyxy(x):
|
|
|
7 |
from transformers import TableTransformerImageProcessor, AutoModelForObjectDetection
|
8 |
import torch
|
9 |
|
10 |
+
import easyocr
|
11 |
+
|
12 |
import gradio as gr
|
13 |
|
14 |
# load table detection model
|
|
|
19 |
structure_processor = TableTransformerImageProcessor(max_size=1000)
|
20 |
structure_model = AutoModelForObjectDetection.from_pretrained("microsoft/table-structure-recognition-v1.1-all")
|
21 |
|
22 |
+
# load EasyOCR reader
|
23 |
+
reader = easyocr.Reader(['en'])
|
24 |
+
|
25 |
|
26 |
# for output bounding box post-processing
|
27 |
def box_cxcywh_to_xyxy(x):
|