How to obtain a single prediction using Learner (fastai)

For practice purposes, I built an encoder-decoder that receives images of 3 and outputs images of 7 using FastAI

!pip install -Uqq fastbook
import fastbook
from fastbook import *

#Loading the images
path = untar_data(URLs.MNIST_SAMPLE)
Path.BASE_PATH = path

#converting them into 728 column tensors

threes = (path/'train'/'3').ls()
sevens = (path/'train'/'7').ls()
threes_valid = (path/'valid'/'3').ls()
sevens_valid = (path/'valid'/'7').ls()

threes_data = [ for i in threes]
sevens_data = [ for i in sevens]
threes_data_v = [ for i in threes_valid]
sevens_data_v = [ for i in sevens_valid]

#To tensors
tensor_3 =[tensor(i).float()/255 for i in threes_data]
tensor_7 = [tensor(i).float()/255 for i in sevens_data]
tensor_3_v =[tensor(i).float()/255 for i in threes_data_v]
tensor_7_v = [tensor(i).float()/255 for i in sevens_data_v]

stack_3 = torch.stack(tensor_3).view(-1,28*28)
stack_7 = torch.stack(tensor_7).view(-1,28*28)
stack_7 = stack_7[:len(stack_3),:] #Making sure 7 and 3 are the same size
stack_3_v =torch.stack(tensor_3_v).view(-1,28*28)
stack_7_v = torch.stack(tensor_7_v).view(-1,28*28)
stack_7_v = stack_7_v[:len(stack_3_v),:] #Making sure 7 and 3 are the same size

#Creating dataloaders
X_train = stack_3.view(-1,28*28)
y_train = stack_7.view(-1,28*28)
X_valid = stack_3_v.view(-1,28*28)
y_valid = stack_7_v.view(-1,28*28)

dset = list(zip(X_train,y_train))
dset_v = list(zip(X_valid,y_valid))

dl = DataLoader(dset,batch_size=256)
dl_v = DataLoader(dset_v,batch_size=256)

dls = DataLoaders(dl,dl_v)

def loss(p,t):
  criterion = nn.MSELoss()
  return criterion(p, t)

simple_net = nn.Sequential(

learn=Learner(dls,simple_net,opt_func=SGD,loss_func = loss),0.1)

get_preds() gives me the predictions for the training set.
preds,targs = learn.get_preds()
show_image(preds[11].view(28,28)), show_image(targs[0].view(28,28))

This seems to work: image image

However when I try to produce a prediction for a single image I get an error:

newp = X_train[1,:]
newimage = learn.predict(newp)

AttributeError                            Traceback (most recent call last)
<ipython-input-118-6693f5f1dc19> in <module>()
----> 1 newimage = learn.predict(newp)

2 frames
/usr/local/lib/python3.6/dist-packages/fastcore/ in __getattr__(self, k)
    151         if self._component_attr_filter(k):
    152             attr = getattr(self,self._default,None)
--> 153             if attr is not None: return getattr(attr,k)
    154         raise AttributeError(k)
    155     def __dir__(self): return custom_dir(self,self._dir())

AttributeError: 'list' object has no attribute 'decode_batch'

Can you please help me figure out where I went wrong here and how I can obtain a prediction for a single image?

Based on this thread it seems predict() expects an image as the input not a tensor or list.

I used learn.model(newp) to get the prediction.