Spaces:
Runtime error
Runtime error
File size: 385 Bytes
8fd2f2f |
1 2 3 4 5 6 7 8 |
from IPython.display import Image as IpyImage
def bytes2html(data, width='auto'):
img_obj = IpyImage(data=data, format='JPG')
for bundle in img_obj._repr_mimebundle_():
for mimetype, b64value in bundle.items():
if mimetype.startswith('image/'):
return f'<img src="data:{mimetype};base64,{b64value}" style="width: {width}; max-width: 100%">' |