Spaces:
Runtime error
Runtime error
Update utility/utils.py
Browse files- utility/utils.py +11 -0
utility/utils.py
CHANGED
|
@@ -10,6 +10,17 @@ import cv2
|
|
| 10 |
import numpy as np
|
| 11 |
from paddleocr import PaddleOCR
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Load environment variables from .env file
|
| 14 |
load_dotenv()
|
| 15 |
|
|
|
|
| 10 |
import numpy as np
|
| 11 |
from paddleocr import PaddleOCR
|
| 12 |
|
| 13 |
+
# Set the PaddleOCR home directory to a writable location
|
| 14 |
+
|
| 15 |
+
os.environ['PADDLEOCR_HOME'] = '/tmp/.paddleocr'
|
| 16 |
+
|
| 17 |
+
# Check if PaddleOCR home directory is writable
|
| 18 |
+
if not os.path.exists('/tmp/.paddleocr'):
|
| 19 |
+
os.makedirs('/tmp/.paddleocr', exist_ok=True)
|
| 20 |
+
logging.info("Created PaddleOCR home directory.")
|
| 21 |
+
else:
|
| 22 |
+
logging.info("PaddleOCR home directory exists.")
|
| 23 |
+
|
| 24 |
# Load environment variables from .env file
|
| 25 |
load_dotenv()
|
| 26 |
|