import pytesseract import shutil import os import random try: from PIL import Image except ImportError: import Image pytesseract.pytesseract.tesseract_cmd = ( r'/usr/bin/tesseract' ) import imutils import re import cv2 import numpy as np import pytesseract from pytesseract import Output from matplotlib import pyplot as plt from pytesseract import image_to_string # Get OCR output using Pytesseract image_path_in_colab='/content/sample4.jpg' #extract = pytesseract.image_to_string(Image.open(image_path_in_colab)) custom_config = r'--oem 3 --psm 6' imagetext = pytesseract.image_to_string(image_path_in_colab)