Download example.py from IvmeLabs/Ivme-Denoise-v1: direct link, hf CLI and curl.
- Browser
- Download file 503 Bytes
-
https://huggingface.co/IvmeLabs/Ivme-Denoise-v1/resolve/main/example.py
- Command line
-
hf download hf://IvmeLabs/Ivme-Denoise-v1/example.py
-
curl -L -o example.py https://huggingface.co/IvmeLabs/Ivme-Denoise-v1/resolve/main/example.py
503 Bytes
| """Minimal example: denoise a photograph with İvme-Denoise-v1.""" | |
| import numpy as np | |
| from PIL import Image | |
| from modeling_ivmetron import load_model, denoise_tiled, estimate_sigma_map | |
| model = load_model(".", device="cuda") | |
| img = np.asarray(Image.open("photo.jpg").convert("RGB"), dtype=np.float32) / 255.0 | |
| out = denoise_tiled(model, img, estimate_sigma_map(img), device="cuda") | |
| Image.fromarray((np.clip(out, 0, 1) * 255).round().astype(np.uint8)).save("clean.png", quality=95) | |
| print("wrote clean.png") | |