Spaces:
Sleeping
Sleeping
Update utility/utils.py
Browse files- utility/utils.py +12 -5
utility/utils.py
CHANGED
|
@@ -108,12 +108,19 @@ def ocr_with_paddle(img):
|
|
| 108 |
boxes = []
|
| 109 |
|
| 110 |
# Initialize PaddleOCR
|
|
|
|
| 111 |
ocr = PaddleOCR(
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
#
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
)
|
| 118 |
# ocr = PaddleOCR(
|
| 119 |
# use_angle_cls=True,
|
|
|
|
| 108 |
boxes = []
|
| 109 |
|
| 110 |
# Initialize PaddleOCR
|
| 111 |
+
# In /app/utility/utils.py
|
| 112 |
ocr = PaddleOCR(
|
| 113 |
+
use_angle_cls=True,
|
| 114 |
+
lang='en',
|
| 115 |
+
enable_mkldnn=False, # <--- Add this line to disable the failing optimization
|
| 116 |
+
use_gpu=False # Ensure this is False if you are on a CPU-only container
|
| 117 |
+
)
|
| 118 |
+
# ocr = PaddleOCR(
|
| 119 |
+
# lang='en',
|
| 120 |
+
# use_angle_cls=True,
|
| 121 |
+
# det_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/det'),
|
| 122 |
+
# rec_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/rec/en/en_PP-OCRv4_rec_infer'),
|
| 123 |
+
# cls_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/cls/ch_ppocr_mobile_v2.0_cls_infer')
|
| 124 |
)
|
| 125 |
# ocr = PaddleOCR(
|
| 126 |
# use_angle_cls=True,
|