Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,6 +45,11 @@ if image_display is not None:
|
|
| 45 |
if st.button("Predict"):
|
| 46 |
infer = model.signatures["serving_default"]
|
| 47 |
output = infer(tf.constant(image_array))
|
| 48 |
-
prediction = output[list(output.keys())[0]].numpy()
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
if st.button("Predict"):
|
| 46 |
infer = model.signatures["serving_default"]
|
| 47 |
output = infer(tf.constant(image_array))
|
| 48 |
+
prediction = output[list(output.keys())[0]].numpy()[0]
|
| 49 |
+
predicted_index = np.argmax(prediction)
|
| 50 |
+
predicted_class = labels[predicted_index]
|
| 51 |
+
confidence = prediction[predicted_index]
|
| 52 |
+
st.success(f"Prediction: {predicted_class.upper()} (Confidence: {confidence:.2f})")
|
| 53 |
+
st.subheader("Class probabilities")
|
| 54 |
+
for label, prob in zip(labels, prediction):
|
| 55 |
+
st.write(f"{label}: {prob:.2f}")
|