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"