import easyocr import cv2 import numpy as np import pyautogui reader = easyocr . Reader ( [ 'en' ] ) while True : screenshot = pyautogui . screenshot ( ) screenshot = cv2 . cvtColor ( np . array ( screenshot ) , cv2 . COLOR_RGB2BGR ) results = reader . readtext ( screenshot ) for ( bbox , text , prob ) in results : text = text . strip ( ) . upper ( ) if text == "A" : print ( 0 ) elif text == "B" : print ( 1 )