Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
# Should import neccessary libraries at the beginning of the notebook
from __future__ import division
from __future__ import annotations
from abc import ABC, abstractmethod
from collections import Counter
from google.cloud import vision
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import re
import cv2
import math
import time
import base64
import binascii
import pytesseract
The command pattern, that uses to implement multiple text extraction solutions, each solution is a Command class, the class must be extends from the ExtractCommand class and required to implement the extract
method. The extract
method should return a tuple, the first value in the tuple is the full text extracted, the second is the full extract data from the API that are using.
The abstract class, all command classes must be implement from this abstraction
class ExtractCommand(ABC):
@abstractmethod
def extract(self):
pass
Google Vision API