Update src/ocr_engine.py
Browse files- src/ocr_engine.py +1 -3
src/ocr_engine.py
CHANGED
@@ -4,11 +4,9 @@ import pytesseract
|
|
4 |
from PIL import Image
|
5 |
|
6 |
def extract_weight_from_image(pil_img):
|
7 |
-
# ✅ Fix for missing libGL (required by OpenCV)
|
8 |
os.system("apt-get update && apt-get install -y libgl1-mesa-glx")
|
9 |
-
import cv2 #
|
10 |
|
11 |
-
# ✅ OCR pipeline
|
12 |
image = np.array(pil_img.convert("RGB"))
|
13 |
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
14 |
blur = cv2.GaussianBlur(gray, (3, 3), 0)
|
|
|
4 |
from PIL import Image
|
5 |
|
6 |
def extract_weight_from_image(pil_img):
|
|
|
7 |
os.system("apt-get update && apt-get install -y libgl1-mesa-glx")
|
8 |
+
import cv2 # imported here to avoid import errors before apt install
|
9 |
|
|
|
10 |
image = np.array(pil_img.convert("RGB"))
|
11 |
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
12 |
blur = cv2.GaussianBlur(gray, (3, 3), 0)
|