Update app.py
Browse files
app.py
CHANGED
@@ -28,9 +28,9 @@ def predict_image(image):
|
|
28 |
predictions = model.predict(image_array)
|
29 |
decoded_predictions = decode_predictions(predictions, top=3)[0]
|
30 |
|
31 |
-
# Format predictions as a
|
32 |
-
results =
|
33 |
-
return results
|
34 |
|
35 |
except Exception as e:
|
36 |
return {"Error": str(e)}
|
|
|
28 |
predictions = model.predict(image_array)
|
29 |
decoded_predictions = decode_predictions(predictions, top=3)[0]
|
30 |
|
31 |
+
# Format predictions as a list of tuples (label, confidence)
|
32 |
+
results = [(label, float(confidence)) for _, label, confidence in decoded_predictions]
|
33 |
+
return dict(results)
|
34 |
|
35 |
except Exception as e:
|
36 |
return {"Error": str(e)}
|