ITSAIDI
commited on
Commit
·
544c870
1
Parent(s):
8bb3f75
scd
Browse files- utilitis.py +4 -1
utilitis.py
CHANGED
@@ -81,7 +81,10 @@ def get_word(bboxes,image):
|
|
81 |
roi = image.crop((x_min, y_min, x_max, y_max)) # Region of intrest
|
82 |
roi_np = np.array(roi) # To array
|
83 |
result = ocr.ocr(roi_np, cls=True) # Apply OCR to ROI
|
84 |
-
|
|
|
|
|
|
|
85 |
#############################################################################
|
86 |
#############################################################################
|
87 |
def get_Finale_results(offset_mapping,id2label,image,prediction_scores,predictions,token_boxes):
|
|
|
81 |
roi = image.crop((x_min, y_min, x_max, y_max)) # Region of intrest
|
82 |
roi_np = np.array(roi) # To array
|
83 |
result = ocr.ocr(roi_np, cls=True) # Apply OCR to ROI
|
84 |
+
if result != [None]:
|
85 |
+
return result[0][0][1][0]
|
86 |
+
else:
|
87 |
+
return ""
|
88 |
#############################################################################
|
89 |
#############################################################################
|
90 |
def get_Finale_results(offset_mapping,id2label,image,prediction_scores,predictions,token_boxes):
|