Diagram-Comparision / text_extraction.py
SathvikGanta's picture
Update text_extraction.py
141dc6f verified
raw
history blame contribute delete
288 Bytes
import pytesseract
from PIL import Image
# Set the Tesseract command path explicitly
pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"
def extract_text(image):
"""Extracts text from the diagram using OCR."""
return pytesseract.image_to_string(Image.fromarray(image))