change to use image files in memory

This commit is contained in:
gilcu3
2023-11-09 18:18:15 +01:00
parent f69f9e5034
commit b2f2114e36
3 changed files with 13 additions and 18 deletions

View File

@@ -381,6 +381,5 @@ def cleanup_intermediate_files(response: any):
# Function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
def encode_image(fileobj):
return base64.b64encode(fileobj.getvalue()).decode('utf-8')