Spaces:
Sleeping
Sleeping
| import base64 | |
| def get_image_data(image_path): | |
| with open(image_path, "rb") as f: | |
| image_data = base64.b64encode(f.read()).decode("utf-8") | |
| return image_data | |
| def get_data_format(image_path): | |
| image_format = image_path.split(".")[-1] | |
| if image_format == "jpg": | |
| image_format = "jpeg" | |
| return image_format |