Download features/image_edit_detector/preprocess.py from Pujan-Dev/AI_API: direct link, hf CLI and curl.
- Browser
- Download file 231 Bytes
-
https://huggingface.co/spaces/Pujan-Dev/AI_API/resolve/main/features/image_edit_detector/preprocess.py
- Command line
-
hf download hf://spaces/Pujan-Dev/AI_API/features/image_edit_detector/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/Pujan-Dev/AI_API/resolve/main/features/image_edit_detector/preprocess.py
231 Bytes
| from PIL import Image | |
| import io | |
| def preprocess_image(img: Image.Image, quality: int) -> Image.Image: | |
| buffer = io.BytesIO() | |
| img.save(buffer, format="JPEG", quality=quality) | |
| buffer.seek(0) | |
| return Image.open(buffer) | |