import os import cv2 import numpy as np from datasets import load_dataset def show_gif(pil_img): pil_img.seek(1) try: while 1: pil_img.seek(pil_img.tell() + 1) cv2_img = cv2.cvtColor(np.array(pil_img), cv2.COLOR_RGB2BGR) cv2.imshow("title", cv2_img) cv2.waitKey(120) # 40 -> 25 fps except EOFError: pass dataset = load_dataset("jorgejgnz/simple-fluid-simulations") show_gif(dataset['train'][0]['image']) cv2.destroyAllWindows()