Demo script included
Browse files- how_to_use.py +20 -0
how_to_use.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import cv2
|
3 |
+
import numpy as np
|
4 |
+
from datasets import load_dataset
|
5 |
+
|
6 |
+
def show_gif(pil_img):
|
7 |
+
pil_img.seek(1)
|
8 |
+
try:
|
9 |
+
while 1:
|
10 |
+
pil_img.seek(pil_img.tell() + 1)
|
11 |
+
cv2_img = cv2.cvtColor(np.array(pil_img), cv2.COLOR_RGB2BGR)
|
12 |
+
cv2.imshow("title", cv2_img)
|
13 |
+
cv2.waitKey(120) # 40 -> 25 fps
|
14 |
+
except EOFError:
|
15 |
+
pass
|
16 |
+
|
17 |
+
dataset = load_dataset("jorgejgnz/simple-fluid-simulations")
|
18 |
+
show_gif(dataset['train'][0]['image'])
|
19 |
+
|
20 |
+
cv2.destroyAllWindows()
|