I am trying to run Tesseract into Google Colab:
!sudo apt install tesseract-ocr
!pip install pytesseract
import pytesseract
import shutil
import os
import random
try:
from PIL import Image
except ImportError:
import Image
from google.colab import files
uploaded = files.upload()
extractedInformation = pytesseract.image_to_string(Image.open('aaa.png'))
print(extractedInformation)
I tried running on an image ('aaa.png') I am uploading, but it runs this error:
TesseractError: (2, 'Usage: pytesseract [-l lang] input_file')
Searching from an almost identical (still unsolved) post, I tried the following code, but still is not working:
pytesseract.pytesseract.tesseract_cmd = (
r'/usr/local/bin/tesseract'
)
I tried to access the pytesseract folder, but it runs this error:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pytesseract/pytesseract.py'