# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import pytesseract

from PIL import Image
#image_to_string: pytesseract.pytesseract.tesseract_cmd = r'C:\Users\USER\AppData\Local\Tesseract-OCR\tesseract.exe'
#pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files\Tesseract-OCR\tessdata'

#pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files\Tesseract-OCR\tesseract.exe'  # your path may be different
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
img = Image.open('test1.jpeg')

result = pytesseract.image_to_string(img)
with open('magic.txt',mode='w') as file:
    file.write(result)
    print( 'magic.txt')
# -

result = pytesseract.image_to_string(img)

type(result)



StarcoderdataJupyterScriptsDedupFiltered