如何用代码块功能插入代码?

问题遇到的现象和发生背景

预测运行报错

用代码块功能插入代码,请勿粘贴截图

def predict(dataset,model):

# unet = torch.load('./core/0.5unet.pkl').to(device)
# torch.save(unet.state_dict(), "model_new.pth")

global res, img_y, mask_arrary
with torch.no_grad():
    x = dataset[0][0].to(device)
    file_name = dataset[1]
    y = model(x)
    img_y = torch.squeeze(y).cpu().numpy()
    img_y[img_y >= rate] = 1
    img_y[img_y < rate] = 0
    img_y = img_y * 255
    cv2.imwrite(f'./tmp/mask/{file_name}_mask.png', img_y,
                (cv2.IMWRITE_PNG_COMPRESSION, 0))
运行结果及报错内容

File "D:\Users\Administrator\PycharmProjects\CTAI-master\CTAI_flask\core\predict.py", line 27, in predict
y = model(x)
TypeError: 'NoneType' object is not callable