CondViT-LRVSF-Demo / src /process_images.py
Slep's picture
Initial Demo.
c45703e
raw
history blame
382 Bytes
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>'