File size: 251 Bytes
0ed7e8f
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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"