CV-Extractor / image_to_text.py
danial2020's picture
Upload 6 files
3f4a167 verified
raw
history blame contribute delete
289 Bytes
from PIL import Image
import pytesseract
import io
pytesseract.pytesseract.tesseract_cmd = r'/usr/bin/tesseract'
def image_to_text(images):
img_bytes = io.BytesIO()
images.save(img_bytes, format='PNG')
text = pytesseract.image_to_string(Image.open(img_bytes))
return text