<jupyter_start><jupyter_text><jupyter_code>!pip install pytesseract
!apt install tesseract-ocr
!apt install libtesseract-dev
import pytesseract
import io
import requests
from PIL import Image, ImageEnhance 
from IPython.display import display
import PIL.ImageOps 
url = requests.get('https://github.com/xprilion/GIFOCR/raw/master/flutterDevGIF.gif')
img = Image.open(io.BytesIO(url.content))
for frame in range(0,img.n_frames):
  
    print("Frame: ", frame+1)
    print("----------------------\n")

    img.seek(frame)
    imgrgb = img.convert('RGB')
    
    imgrgb = PIL.ImageOps.invert(imgrgb)
    
    enhancer = ImageEnhance.Brightness(imgrgb)
    imgrgb = enhancer.enhance(1.8)
    
    enhancer = ImageEnhance.Contrast(imgrgb)
    imgrgb = enhancer.enhance(4.0)

    imgrgb = imgrgb.convert('1')
    display(imgrgb)
    text = pytesseract.image_to_string(imgrgb)
    
    print(text)
    print("======================\n")<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup