get_img_base64

This commit is contained in:
glide-the 2024-05-21 14:24:21 +08:00
parent 79be52fa18
commit ae318c7811

View File

@ -699,7 +699,7 @@ def get_img_base64(file_name: str) -> str:
get_img_base64 used in streamlit. get_img_base64 used in streamlit.
absolute local path not working on windows. absolute local path not working on windows.
''' '''
image = f"{IMG_DIR}/img/{file_name}" image = f"{IMG_DIR}/{file_name}"
# 读取图片 # 读取图片
with open(image, "rb") as f: with open(image, "rb") as f:
buffer = BytesIO(f.read()) buffer = BytesIO(f.read())