realtime-digit-draw / inference.py
ByteJoseph's picture
Upload folder using huggingface_hub
9277f2e verified
Raw History Blame Contribute Delete
248 Bytes
import torch
from model import ANN
model = ANN()
model.load_state_dict(torch.load("weights.pth", map_location="cpu"))
model.eval()
def predict(image_tensor):
with torch.no_grad():
return model(image_tensor).argmax(1).item()