An't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first

def predict(image_path, model, top_k=top_num):

model.to(power)
model.eval()

torch_image =torch.from_numpy(np.expand_dims(process_image(image_path),
                                        axis = 0)).type(torch.FloatTensor).to(power)

  
log_prob = model.forward(torch_image)

linear_probs = torch.exp(log_prob)   

top_probs, top_labs = linear_probs.topk(top_k, dim =1)

idx_to_class = {}
for key, value in model.class_to_idx.items():
    idx_to_class[value] = key

np_top_labs = top_labs[0].numpy()

top_labels = []
for label in np_top_labs:
    top_labels.append(int(idx_to_class[label]))

top_flowers = [cat_to_name[str(lab)] for lab in top_labels]

return top_probs, top_labels, top_flowers

image_path = path_image

prob, classes, flowers = predict(image_path,model)

As the error describes, you would have to transfer the CUDATensor to the CPU first, since numpy cannot use GPU tensors.
Assuming this line of code raises the issue:

np_top_labs = top_labs[0].numpy()

use this instead:

np_top_labs = top_labs[0].cpu().numpy()

(and .detach(), if necessary).

Thank you for the support.

Regards