stshanks commited on
Commit
0318ae9
·
verified ·
1 Parent(s): 73f86ab

Update app.py

Browse files

add logging of predicted index

Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -33,6 +33,7 @@ def decode_prediction(prediction):
33
  return "Error: Unexpected model output shape"
34
 
35
  predicted_index = np.argmax(prediction, axis=-1)[0] # Get the index of the highest probability
 
36
  return CLASS_NAMES[predicted_index] # Return the corresponding drug name
37
 
38
  # Function to preprocess the uploaded image
@@ -56,9 +57,6 @@ def predict_text(image):
56
  processed_image = preprocess_image(image) # Ensure input is (64, 64, 3)
57
  prediction = model.predict(processed_image)
58
 
59
- print("Model output shape:", prediction.shape) # Should be (1, 78)
60
- print("Model output values:", prediction) # Print raw probabilities
61
-
62
  # Decode the prediction to get the drug name
63
  predicted_text = decode_prediction(prediction)
64
  return predicted_text
 
33
  return "Error: Unexpected model output shape"
34
 
35
  predicted_index = np.argmax(prediction, axis=-1)[0] # Get the index of the highest probability
36
+ print ("Predicted Index:", predicted_index)
37
  return CLASS_NAMES[predicted_index] # Return the corresponding drug name
38
 
39
  # Function to preprocess the uploaded image
 
57
  processed_image = preprocess_image(image) # Ensure input is (64, 64, 3)
58
  prediction = model.predict(processed_image)
59
 
 
 
 
60
  # Decode the prediction to get the drug name
61
  predicted_text = decode_prediction(prediction)
62
  return predicted_text