ADobrovsky commited on
Commit
3a6f9c8
1 Parent(s): 9b9738e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -31,7 +31,8 @@ predictTransform = transforms.Compose([
31
 
32
  def predict(img):
33
  img = predictTransform(img).unsqueeze(0).to(DEVICE)
34
- with torch.inference_mode():
 
35
  prediction = torch.nn.functional.softmax(model(img)[0], dim=0)
36
  confidences = {labels[i]: float(prediction[i]) for i in range(len(labels))}
37
  return confidences
 
31
 
32
  def predict(img):
33
  img = predictTransform(img).unsqueeze(0).to(DEVICE)
34
+ with torch.no_grad():
35
+ model.eval()
36
  prediction = torch.nn.functional.softmax(model(img)[0], dim=0)
37
  confidences = {labels[i]: float(prediction[i]) for i in range(len(labels))}
38
  return confidences