Auto-weight-logger / src /ocr_engine.py
Sanjayraju30's picture
Rename ocr_engine.py to src/ocr_engine.py
0ed7e8f verified
raw
history blame contribute delete
251 Bytes
import pytesseract
from PIL import Image
import re
def extract_weight_from_image(image):
text = pytesseract.image_to_string(image)
match = re.search(r"\d+\.\d{2}", text)
if match:
return match.group()
return "No weight found"