fixed all decorators
Browse files- app_pages/ocr_comparator.py +22 -11
app_pages/ocr_comparator.py
CHANGED
@@ -185,7 +185,8 @@ def app():
|
|
185 |
out_cols_size, out_dict_back_colors, out_fig
|
186 |
|
187 |
###
|
188 |
-
|
|
|
189 |
def init_easyocr(in_params):
|
190 |
"""Initialization of easyOCR reader
|
191 |
|
@@ -213,7 +214,8 @@ def app():
|
|
213 |
return out_ocr
|
214 |
|
215 |
###
|
216 |
-
|
|
|
217 |
def init_mmocr(in_params):
|
218 |
"""Initialization of MMOCR reader
|
219 |
|
@@ -287,7 +289,8 @@ def app():
|
|
287 |
return out_image_path, out_image_orig, out_image_cv2
|
288 |
|
289 |
###
|
290 |
-
|
|
|
291 |
def easyocr_detect(_in_reader, in_image_path, in_params):
|
292 |
"""Detection with EasyOCR
|
293 |
|
@@ -320,7 +323,8 @@ def app():
|
|
320 |
return out_easyocr_boxes_coordinates, out_status
|
321 |
|
322 |
###
|
323 |
-
|
|
|
324 |
def ppocr_detect(_in_reader, in_image_path):
|
325 |
"""Detection with PPOCR
|
326 |
|
@@ -343,7 +347,8 @@ def app():
|
|
343 |
return out_ppocr_boxes_coordinates, out_status
|
344 |
|
345 |
###
|
346 |
-
|
|
|
347 |
def mmocr_detect(_in_reader, in_image_path):
|
348 |
"""Detection with MMOCR
|
349 |
|
@@ -403,7 +408,8 @@ def app():
|
|
403 |
return out_cropped
|
404 |
|
405 |
###
|
406 |
-
|
|
|
407 |
def tesserocr_detect(in_image_path, _in_img, in_params):
|
408 |
"""Detection with Tesseract
|
409 |
|
@@ -434,7 +440,8 @@ def app():
|
|
434 |
return out_tesserocr_boxes_coordinates, out_status
|
435 |
|
436 |
###
|
437 |
-
|
|
|
438 |
def process_detect(in_image_path, _in_list_images, _in_list_readers, in_list_params, in_color):
|
439 |
"""Detection process for each OCR solution
|
440 |
|
@@ -542,7 +549,8 @@ def app():
|
|
542 |
return out_image_drawn
|
543 |
|
544 |
###
|
545 |
-
|
|
|
546 |
def get_cropped(in_boxes_coordinates, in_image_cv):
|
547 |
"""Construct list of cropped images corresponding of the input boxes coordinates list
|
548 |
|
@@ -665,7 +673,8 @@ def app():
|
|
665 |
return out_list_text_easyocr, out_list_confidence_easyocr, out_status
|
666 |
|
667 |
###
|
668 |
-
|
|
|
669 |
def ppocr_recog(in_list_images, in_params):
|
670 |
"""Recognition with PPOCR
|
671 |
|
@@ -704,7 +713,8 @@ def app():
|
|
704 |
return out_list_text_ppocr, out_list_confidence_ppocr, out_status
|
705 |
|
706 |
###
|
707 |
-
|
|
|
708 |
def mmocr_recog(in_list_images, in_params):
|
709 |
"""Recognition with MMOCR
|
710 |
|
@@ -744,7 +754,8 @@ def app():
|
|
744 |
return out_list_text_mmocr, out_list_confidence_mmocr, out_status
|
745 |
|
746 |
###
|
747 |
-
|
|
|
748 |
def tesserocr_recog(in_img, in_params, in_nb_images):
|
749 |
"""Recognition with Tesseract
|
750 |
|
|
|
185 |
out_cols_size, out_dict_back_colors, out_fig
|
186 |
|
187 |
###
|
188 |
+
#@st.experimental_memo(show_spinner=False)
|
189 |
+
@st.cache_data
|
190 |
def init_easyocr(in_params):
|
191 |
"""Initialization of easyOCR reader
|
192 |
|
|
|
214 |
return out_ocr
|
215 |
|
216 |
###
|
217 |
+
#@st.experimental_memo(show_spinner=False)
|
218 |
+
@st.cache_data
|
219 |
def init_mmocr(in_params):
|
220 |
"""Initialization of MMOCR reader
|
221 |
|
|
|
289 |
return out_image_path, out_image_orig, out_image_cv2
|
290 |
|
291 |
###
|
292 |
+
#@st.experimental_memo(show_spinner=False)
|
293 |
+
@st.cache_data
|
294 |
def easyocr_detect(_in_reader, in_image_path, in_params):
|
295 |
"""Detection with EasyOCR
|
296 |
|
|
|
323 |
return out_easyocr_boxes_coordinates, out_status
|
324 |
|
325 |
###
|
326 |
+
#@st.experimental_memo(show_spinner=False)
|
327 |
+
@st.cache_data
|
328 |
def ppocr_detect(_in_reader, in_image_path):
|
329 |
"""Detection with PPOCR
|
330 |
|
|
|
347 |
return out_ppocr_boxes_coordinates, out_status
|
348 |
|
349 |
###
|
350 |
+
#@st.experimental_memo(show_spinner=False)
|
351 |
+
@st.cache_data
|
352 |
def mmocr_detect(_in_reader, in_image_path):
|
353 |
"""Detection with MMOCR
|
354 |
|
|
|
408 |
return out_cropped
|
409 |
|
410 |
###
|
411 |
+
#@st.experimental_memo(show_spinner=False)
|
412 |
+
@st.cache_data
|
413 |
def tesserocr_detect(in_image_path, _in_img, in_params):
|
414 |
"""Detection with Tesseract
|
415 |
|
|
|
440 |
return out_tesserocr_boxes_coordinates, out_status
|
441 |
|
442 |
###
|
443 |
+
#@st.experimental_memo(show_spinner=False)
|
444 |
+
@st.cache_data
|
445 |
def process_detect(in_image_path, _in_list_images, _in_list_readers, in_list_params, in_color):
|
446 |
"""Detection process for each OCR solution
|
447 |
|
|
|
549 |
return out_image_drawn
|
550 |
|
551 |
###
|
552 |
+
#@st.experimental_memo(show_spinner=False)
|
553 |
+
@st.cache_data
|
554 |
def get_cropped(in_boxes_coordinates, in_image_cv):
|
555 |
"""Construct list of cropped images corresponding of the input boxes coordinates list
|
556 |
|
|
|
673 |
return out_list_text_easyocr, out_list_confidence_easyocr, out_status
|
674 |
|
675 |
###
|
676 |
+
#@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
|
677 |
+
@st.cache_data
|
678 |
def ppocr_recog(in_list_images, in_params):
|
679 |
"""Recognition with PPOCR
|
680 |
|
|
|
713 |
return out_list_text_ppocr, out_list_confidence_ppocr, out_status
|
714 |
|
715 |
###
|
716 |
+
#@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
|
717 |
+
@st.cache_data
|
718 |
def mmocr_recog(in_list_images, in_params):
|
719 |
"""Recognition with MMOCR
|
720 |
|
|
|
754 |
return out_list_text_mmocr, out_list_confidence_mmocr, out_status
|
755 |
|
756 |
###
|
757 |
+
#@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
|
758 |
+
@st.cache_data
|
759 |
def tesserocr_recog(in_img, in_params, in_nb_images):
|
760 |
"""Recognition with Tesseract
|
761 |
|