Spaces:
Build error
Build error
Download bin/mask_example.py from electblake/Inpaint-Anything-LaMa: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/spaces/electblake/Inpaint-Anything-LaMa/resolve/main/bin/mask_example.py
- Command line
-
hf download hf://spaces/electblake/Inpaint-Anything-LaMa/bin/mask_example.py
-
curl -L -o mask_example.py https://huggingface.co/spaces/electblake/Inpaint-Anything-LaMa/resolve/main/bin/mask_example.py
466 Bytes
| import matplotlib.pyplot as plt | |
| from skimage import io | |
| from skimage.transform import resize | |
| from saicinpainting.evaluation.masks.mask import SegmentationMask | |
| im = io.imread('imgs/ex4.jpg') | |
| im = resize(im, (512, 1024), anti_aliasing=True) | |
| mask_seg = SegmentationMask(num_variants_per_mask=10) | |
| mask_examples = mask_seg.get_masks(im) | |
| for i, example in enumerate(mask_examples): | |
| plt.imshow(example) | |
| plt.show() | |
| plt.imsave(f'tmp/img_masks/{i}.png', example) | |