Spaces:
Sleeping
Sleeping
WebashalarForML
commited on
Commit
•
26e0db5
1
Parent(s):
0f84ab0
Update utility/utils.py
Browse files- utility/utils.py +7 -1
utility/utils.py
CHANGED
@@ -23,6 +23,12 @@ logging.basicConfig(
|
|
23 |
|
24 |
os.environ['PADDLEOCR_HOME'] = '/tmp/.paddleocr'
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# Check if PaddleOCR home directory is writable
|
27 |
if not os.path.exists('/tmp/.paddleocr'):
|
28 |
os.makedirs('/tmp/.paddleocr', exist_ok=True)
|
@@ -115,7 +121,7 @@ def ocr_with_paddle(img):
|
|
115 |
finaltext += ' ' + text
|
116 |
return finaltext
|
117 |
|
118 |
-
def extract_text_from_images(image_paths
|
119 |
all_extracted_texts = {}
|
120 |
all_extracted_imgs = {}
|
121 |
for image_path in image_paths:
|
|
|
23 |
|
24 |
os.environ['PADDLEOCR_HOME'] = '/tmp/.paddleocr'
|
25 |
|
26 |
+
RESULT_FOLDER = 'static/results/'
|
27 |
+
os.makedirs(RESULT_FOLDER, exist_ok=True)
|
28 |
+
|
29 |
+
if not os.path.exists(app.config['RESULT_FOLDER']):
|
30 |
+
os.makedirs(app.config['RESULT_FOLDER'])
|
31 |
+
|
32 |
# Check if PaddleOCR home directory is writable
|
33 |
if not os.path.exists('/tmp/.paddleocr'):
|
34 |
os.makedirs('/tmp/.paddleocr', exist_ok=True)
|
|
|
121 |
finaltext += ' ' + text
|
122 |
return finaltext
|
123 |
|
124 |
+
def extract_text_from_images(image_paths):
|
125 |
all_extracted_texts = {}
|
126 |
all_extracted_imgs = {}
|
127 |
for image_path in image_paths:
|