ebookify-backend2 / image_to_text.py
Geetansh
changed pytesseract code as tesseract-ocr would be available in PATH in hf spaces
52916f3
raw
history blame
530 Bytes
from PIL import Image
import pytesseract
# # If you don't have tesseract executable in your PATH, include the following:
# pytesseract.pytesseract.tesseract_cmd = r'C:\TesseractOCR\tesseract'
# # Simple image to string
# def img2string(imgPath):
# textOfImage = pytesseract.image_to_string(imgPath)
# return textOfImage
# Changed version of above code for deployment on huggingface spaces
# Simple image to string
def img2string(imgPath):
textOfImage = pytesseract.image_to_string(imgPath)
return textOfImage