Leadgen-AdGenesis / helpers.py
userIdc2024's picture
Upload 6 files
333e771 verified
raw
history blame contribute delete
302 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"))