Download backend/services/utils.py from UKielz/Test: direct link, hf CLI and curl.
- Browser
- Download file 248 Bytes
-
https://huggingface.co/spaces/UKielz/Test/resolve/main/backend/services/utils.py
- Command line
-
hf download hf://spaces/UKielz/Test/backend/services/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/UKielz/Test/resolve/main/backend/services/utils.py
248 Bytes
| import base64 | |
| from io import BytesIO | |
| from PIL import Image | |
| def validate_image_base64(image_base64: str) -> bool: | |
| try: | |
| Image.open(BytesIO(base64.b64decode(image_base64))) | |
| return True | |
| except: | |
| return False | |