in app/app.py [0:0]
def _convert_path_to_data_uri(path) -> str:
mime_type, _ = guess_type(path)
with open(path, "rb") as image_file:
data = image_file.read()
data_uri = f"data:{mime_type};base64," + b64encode(data).decode("utf-8")
return data_uri