File size: 228 Bytes
a746d34
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import pytesseract
from PIL import Image
import os

def ocr_image(image_path):
    """
    Extract text from an image using OCR
    """
    img = Image.open(image_path)
    text = pytesseract.image_to_string(img)
    return text