Spaces:
Sleeping
Sleeping
Download data/util.py from jingyi0305/sufe_pre: direct link, hf CLI and curl.
- Browser
- Download file 243 Bytes
-
https://huggingface.co/spaces/jingyi0305/sufe_pre/resolve/main/data/util.py
- Command line
-
hf download hf://spaces/jingyi0305/sufe_pre/data/util.py
-
curl -L -o util.py https://huggingface.co/spaces/jingyi0305/sufe_pre/resolve/main/data/util.py
243 Bytes
| from PIL import Image | |
| def is_image_file(filename): | |
| return any(filename.endswith(extension) for extension in [".png", ".jpg", ".bmp", ".JPG", ".jpeg"]) | |
| def load_img(filepath): | |
| img = Image.open(filepath).convert('RGB') | |
| return img | |