dielz commited on
Commit
a665b6d
·
verified ·
1 Parent(s): b3554c8

change prediction display

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -15,13 +15,11 @@ def predict_image(image):
15
  image_array = np.expand_dims(image_array, axis=0)
16
 
17
  predictions = model.signatures['serving_default'](tf.convert_to_tensor(image_array, dtype=tf.float32))['output_0']
18
-
19
- probabilities = tf.nn.softmax(predictions, axis=1).numpy()
20
 
21
  # Highest prediction
22
- top_index = np.argmax(probabilities, axis=1)[0]
23
  top_label = labels[top_index]
24
- top_probability = probabilities[0][top_index] * 100
25
 
26
  return {top_label:top_probability}
27
 
 
15
  image_array = np.expand_dims(image_array, axis=0)
16
 
17
  predictions = model.signatures['serving_default'](tf.convert_to_tensor(image_array, dtype=tf.float32))['output_0']
 
 
18
 
19
  # Highest prediction
20
+ top_index = np.argmax(predictions.numpy(), axis=1)[0]
21
  top_label = labels[top_index]
22
+ top_probability = predictions.numpy()[0][top_index]
23
 
24
  return {top_label:top_probability}
25