Spaces:
Sleeping
Sleeping
busebaser
commited on
Commit
·
49fadad
1
Parent(s):
c5b14f4
Fix: Convert Tensor confidence score to float
Browse files
app.py
CHANGED
@@ -23,9 +23,11 @@ def predict(image):
|
|
23 |
|
24 |
# Run prediction
|
25 |
pred, _, probs = model.predict(image)
|
26 |
-
|
27 |
|
28 |
-
|
|
|
|
|
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}")
|