File size: 382 Bytes
c45703e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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'<img height=200px src="data:image/png;base64,{base64.b64encode(buffer).decode()}"></img>'