pmkhanh7890's picture
refactor code + fix bug of label after grouping url
00b1038
raw
history blame
339 Bytes
import base64
def encode_image(image_path):
with open(image_path, "rb") as img_file:
return base64.b64encode(img_file.read()).decode()
image_base64 = encode_image(
"/content/ai-generated-picture-of-a-tiger-walking-in-the-forest-photo.jpg",
)
html_code = f'<img src="data:image/jpeg;base64,{image_base64}" width="300">'