harshaUwm163 commited on
Commit
8e021d8
·
1 Parent(s): 6cad4ba

adding a dict of prediction probabilities along with class names

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -48,9 +48,11 @@ def infer(input_image):
48
  print(image_tensor.shape)
49
  predictions = model.predict(np.expand_dims((image_tensor), axis=0))
50
  predictions = np.squeeze(predictions)
51
- predictions = np.argmax(predictions) # , axis=2
52
- predicted_label = class_names[predictions.item()]
53
- return str(predicted_label)
 
 
54
 
55
 
56
  # get the inputs
 
48
  print(image_tensor.shape)
49
  predictions = model.predict(np.expand_dims((image_tensor), axis=0))
50
  predictions = np.squeeze(predictions)
51
+ # predictions = np.argmax(predictions) # , axis=2
52
+ # predicted_label = class_names[predictions.item()]
53
+ # return str(predicted_label)
54
+
55
+ return dict(zip(class_names, predictions))
56
 
57
 
58
  # get the inputs