Spaces:
Runtime error
Runtime error
Download utils.py from sharifIslam/MV3DR: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/sharifIslam/MV3DR/resolve/main/utils.py
- Command line
-
hf download hf://spaces/sharifIslam/MV3DR/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/sharifIslam/MV3DR/resolve/main/utils.py
447 Bytes
| import os, tempfile | |
| from PIL import Image, ImageEnhance | |
| def preprocess(image_paths): | |
| cleaned = [] | |
| for i, path in enumerate(image_paths): | |
| img = Image.open(path).convert("RGB") | |
| img = ImageEnhance.Contrast(img).enhance(1.2) | |
| img = ImageEnhance.Sharpness(img).enhance(1.5) | |
| out = os.path.join(tempfile.gettempdir(), f"input_refined_{i}.png") | |
| img.save(out) | |
| cleaned.append(out) | |
| return cleaned | |