Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,10 +48,11 @@ def predict(img):
|
|
48 |
|
49 |
preds = model.predict(img)[0]
|
50 |
|
51 |
-
#
|
52 |
-
|
|
|
53 |
|
54 |
-
return
|
55 |
except Exception as e:
|
56 |
# Print the exception to the console
|
57 |
print(f"Error during prediction: {e}")
|
|
|
48 |
|
49 |
preds = model.predict(img)[0]
|
50 |
|
51 |
+
# Tahmin sonuçlarını formatla
|
52 |
+
sorted_preds = sorted(zip(labels, preds), key=lambda x: x[1], reverse=True)[:3]
|
53 |
+
formatted_preds = "\n".join([f"{label}: {prob:.2f}" for label, prob in sorted_preds])
|
54 |
|
55 |
+
return formatted_preds
|
56 |
except Exception as e:
|
57 |
# Print the exception to the console
|
58 |
print(f"Error during prediction: {e}")
|