Spaces:
Sleeping
Sleeping
| import base64, os | |
| def encode_image_to_base64(image_path: str) -> str: | |
| with open(image_path, "rb") as f: | |
| return base64.b64encode(f.read()).decode("utf-8") | |
| def is_valid_image(file_name: str) -> bool: | |
| return file_name.lower().endswith((".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp")) | |