tonyliu404 commited on
Commit
9b14029
·
verified ·
1 Parent(s): a6b6017

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -234,12 +234,14 @@ def classifyImage(input_image):
234
 
235
  # Add a batch dimension
236
  input_array = tf.expand_dims(input_array, 0) # (1, 224, 224, 3)
237
-
 
 
238
  predictions = model.predict(input_array)[0]
239
  print(f"Predictions: {predictions}")
240
 
241
  # Sort predictions to get top 5
242
- top_indices = np.argsort(predictions)[-5:]
243
 
244
  # Prepare the top 5 predictions with their class names and percentages
245
  top_predictions = [(class_names[i], predictions[i] * 100) for i in top_indices]
 
234
 
235
  # Add a batch dimension
236
  input_array = tf.expand_dims(input_array, 0) # (1, 224, 224, 3)
237
+
238
+ temp = tf.nn.softmax(predictions).numpy()
239
+ print("SOFTMAX PREDICTIONS",temp)
240
  predictions = model.predict(input_array)[0]
241
  print(f"Predictions: {predictions}")
242
 
243
  # Sort predictions to get top 5
244
+ top_indices = np.argsort(predictions)[-5:][::-1]
245
 
246
  # Prepare the top 5 predictions with their class names and percentages
247
  top_predictions = [(class_names[i], predictions[i] * 100) for i in top_indices]