Update: I had to customize show_image
to display without using ax
to get it to work. It seems that widget.Output()
does not like to display images using ax
. Using this instead now works:
def show_imagee(im, **kwargs):
"Show_image helper for viewing images in Voila"
# Handle pytorch axis order
if hasattrs(im, ('data','cpu','permute')):
im = im.data.cpu()
if im.shape[0]<5: im=im.permute(1,2,0)
elif not isinstance(im,np.ndarray): im=array(im)
# Handle 1-channel images
if im.shape[-1]==1: im=im[...,0]
it = Tensor(im)
img = Image.fromarray(im, 'RGB')
display(img)
So now it works in voila (the second smaller image was the one that was not showing before)