busebaser commited on
Commit
49fadad
·
1 Parent(s): c5b14f4

Fix: Convert Tensor confidence score to float

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -23,9 +23,11 @@ def predict(image):
23
 
24
  # Run prediction
25
  pred, _, probs = model.predict(image)
26
- print(f"✅ Prediction successful: {pred}, Confidence: {probs.max():.2f}")
27
 
28
- return f"Prediction: {pred} (Confidence: {probs.max():.2f})"
 
 
29
 
30
  except Exception as e:
31
  print(f"❌ Error during prediction: {e}")
 
23
 
24
  # Run prediction
25
  pred, _, probs = model.predict(image)
26
+ confidence = float(probs.max()) # Convert Tensor to float
27
 
28
+ print(f"Prediction successful: {pred}, Confidence: {confidence:.2f}")
29
+
30
+ return f"Prediction: {pred} (Confidence: {confidence:.2f})"
31
 
32
  except Exception as e:
33
  print(f"❌ Error during prediction: {e}")