Vivek-AdGenesis-St / src /helpers.py
userIdc2024's picture
Update src/helpers.py
04b214b verified
raw
history blame contribute delete
301 Bytes
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"))