Spaces:
Sleeping
Sleeping
ITSAIDI
commited on
Commit
•
a3d93e8
1
Parent(s):
a35180c
scd
Browse files- utilitis.py +6 -5
utilitis.py
CHANGED
@@ -7,11 +7,10 @@ import numpy as np
|
|
7 |
import time
|
8 |
|
9 |
model_Hugging_path = "Noureddinesa/Output_LayoutLMv3_v7"
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
)
|
15 |
|
16 |
#############################################################################
|
17 |
#############################################################################
|
@@ -39,6 +38,7 @@ def processbbox(BBOX, width, height):
|
|
39 |
|
40 |
|
41 |
def Preprocess(image):
|
|
|
42 |
image_array = np.array(image)
|
43 |
width, height = image.size
|
44 |
results = ocr.ocr(image_array, cls=False,rec = True)
|
@@ -83,6 +83,7 @@ def drop_null_bbox(dictionary):
|
|
83 |
del dictionary[key]
|
84 |
|
85 |
def get_word(bboxes,image):
|
|
|
86 |
x_min, y_min, x_max, y_max = bboxes
|
87 |
roi = image.crop((x_min, y_min, x_max, y_max)) # Region of intrest
|
88 |
roi_np = np.array(roi) # To array
|
|
|
7 |
import time
|
8 |
|
9 |
model_Hugging_path = "Noureddinesa/Output_LayoutLMv3_v7"
|
10 |
+
|
11 |
+
def Paddle():
|
12 |
+
ocr = PaddleOCR(use_angle_cls=False,lang='fr',rec=False)
|
13 |
+
return ocr
|
|
|
14 |
|
15 |
#############################################################################
|
16 |
#############################################################################
|
|
|
38 |
|
39 |
|
40 |
def Preprocess(image):
|
41 |
+
ocr = Paddle()
|
42 |
image_array = np.array(image)
|
43 |
width, height = image.size
|
44 |
results = ocr.ocr(image_array, cls=False,rec = True)
|
|
|
83 |
del dictionary[key]
|
84 |
|
85 |
def get_word(bboxes,image):
|
86 |
+
ocr = Paddle()
|
87 |
x_min, y_min, x_max, y_max = bboxes
|
88 |
roi = image.crop((x_min, y_min, x_max, y_max)) # Region of intrest
|
89 |
roi_np = np.array(roi) # To array
|