type hint
Browse files
README.md
CHANGED
@@ -9,7 +9,7 @@ Read from the webdataset (after saving it somewhere on your disk) like this:
|
|
9 |
|
10 |
```python
|
11 |
from webdataset import WebDataset
|
12 |
-
from typing import TypedDict
|
13 |
from PIL import Image
|
14 |
from PIL.PngImagePlugin import PngImageFile
|
15 |
from io import BytesIO
|
@@ -26,7 +26,8 @@ dataset = WebDataset('./openai-guided-diffusion-256-classcond-unguided-samples-5
|
|
26 |
out_root = 'out'
|
27 |
makedirs(out_root, exist_ok=True)
|
28 |
|
29 |
-
|
|
|
30 |
with BytesIO(item['img.png']) as stream:
|
31 |
img: PngImageFile = Image.open(stream)
|
32 |
img.load()
|
|
|
9 |
|
10 |
```python
|
11 |
from webdataset import WebDataset
|
12 |
+
from typing import TypedDict, Iterable
|
13 |
from PIL import Image
|
14 |
from PIL.PngImagePlugin import PngImageFile
|
15 |
from io import BytesIO
|
|
|
26 |
out_root = 'out'
|
27 |
makedirs(out_root, exist_ok=True)
|
28 |
|
29 |
+
it: Iterable[Example] = iter(dataset)
|
30 |
+
for ix, item in enumerate(it):
|
31 |
with BytesIO(item['img.png']) as stream:
|
32 |
img: PngImageFile = Image.open(stream)
|
33 |
img.load()
|