DawnC commited on
Commit
3a1685e
1 Parent(s): 9e437f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -43,7 +43,7 @@ def classify_image(image):
43
  probabilities, indices = torch.topk(outputs, k=3) # top 3 predictions
44
  probabilities = torch.nn.functional.softmax(probabilities, dim=1)
45
  predictions = [(class_names[idx], prob.item()) for idx, prob in zip(indices[0], probabilities[0])]
46
- return {class_name: f"{prob * 100:.2f}%" for class_name, prob in predictions}
47
 
48
 
49
  examples_path = './examples'
 
43
  probabilities, indices = torch.topk(outputs, k=3) # top 3 predictions
44
  probabilities = torch.nn.functional.softmax(probabilities, dim=1)
45
  predictions = [(class_names[idx], prob.item()) for idx, prob in zip(indices[0], probabilities[0])]
46
+ return {class_name: prob for class_name, prob in predictions}
47
 
48
 
49
  examples_path = './examples'