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