MCPcopy Index your code
hub / github.com/huggingface/datasets / test_image_feature_encode_example

Function test_image_feature_encode_example

tests/features/test_image.py:67–77  ·  view source on GitHub ↗
(shared_datadir, build_example)

Source from the content-addressed store, hash-verified

65 ],
66)
67def test_image_feature_encode_example(shared_datadir, build_example):
68 import PIL.Image
69
70 image_path = str(shared_datadir / "test_image_rgb.jpg")
71 image = Image()
72 encoded_example = image.encode_example(build_example(image_path))
73 assert isinstance(encoded_example, dict)
74 assert encoded_example.keys() == {"bytes", "path"}
75 assert encoded_example["bytes"] is not None or encoded_example["path"] is not None
76 decoded_example = image.decode_example(encoded_example)
77 assert isinstance(decoded_example, PIL.Image.Image)
78
79
80@require_pil

Callers

nothing calls this directly

Calls 3

encode_exampleMethod · 0.95
decode_exampleMethod · 0.95
ImageClass · 0.90

Tested by

no test coverage detected