Refactor prediction function: update prediction handling to print raw predictions and extract first element
Browse files
app.py
CHANGED
@@ -63,7 +63,13 @@ def predict(data):
|
|
63 |
img = img.reshape(1, 28, 28, 1)
|
64 |
|
65 |
# Model predictions
|
66 |
-
preds = model.predict(img)
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
# Return the probability for each class
|
69 |
return {label: float(pred) for label, pred in zip(labels, preds)}
|
|
|
63 |
img = img.reshape(1, 28, 28, 1)
|
64 |
|
65 |
# Model predictions
|
66 |
+
preds = model.predict(img)
|
67 |
+
|
68 |
+
print(preds)
|
69 |
+
|
70 |
+
preds = preds[0]
|
71 |
+
print(preds)
|
72 |
+
|
73 |
|
74 |
# Return the probability for each class
|
75 |
return {label: float(pred) for label, pred in zip(labels, preds)}
|