Sanjayraju30 commited on
Commit
faac1d1
·
verified ·
1 Parent(s): f038ea6

Update src/ocr_engine.py

Browse files
Files changed (1) hide show
  1. 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 # Must be imported after installing libGL
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)