Spaces:
Sleeping
Sleeping
File size: 221 Bytes
3ccb758 | 1 2 3 4 5 6 7 8 9 | import base64
def encode_image(image_path):
"""
Encodes an image file to a base64 string.
"""
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
|