Spaces:
Sleeping
Sleeping
Download features/image_edit_detector/preprocess.py from can-org/Testing-AI-Contain: direct link, hf CLI and curl.
- Browser
- Download file 231 Bytes
-
https://huggingface.co/spaces/can-org/Testing-AI-Contain/resolve/refs%2Fpr%2F2/features/image_edit_detector/preprocess.py
- Command line
-
hf download hf://spaces/can-org/Testing-AI-Contain@refs/pr/2/features/image_edit_detector/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/can-org/Testing-AI-Contain/resolve/refs%2Fpr%2F2/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) | |