from PIL import Image from io import BytesIO import base64 # Index to PIL def process_img(idx, ds): img = Image.open(BytesIO(ds.iloc[idx].jpg)).convert("RGB") return img def make_img_html(img): b = BytesIO() img.save(b, format='PNG') buffer = b.getvalue() return f''