Spaces:
Configuration error

TrustLensAI / ocr.py
bhoomee's picture
Upload ocr.py
a25618f verified
Raw History Blame Contribute Delete
504 Bytes
import pytesseract
from PIL import Image
# ==============================
# TESSERACT PATH
# ==============================
pytesseract.pytesseract.tesseract_cmd = (
r"C:\Program Files\Tesseract-OCR\tesseract.exe"
)
# ==============================
# OCR TEXT EXTRACTION
# ==============================
def extract_text(image_path):
image = Image.open(
image_path
)
text = pytesseract.image_to_string(
image
)
return text