Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -87,11 +87,11 @@ def classify_image(image):
|
|
87 |
|
88 |
# Get probabilities for all classes
|
89 |
probabilities = loaded_svm_model.predict_proba(image_features)[0]
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
predicted_scores = "\n".join(
|
95 |
|
96 |
# Get key facts about the predicted mineral
|
97 |
mineral_key_facts = mineral_facts.get(predicted_class_name, "No key facts available for this mineral.")
|
@@ -103,7 +103,6 @@ def classify_image(image):
|
|
103 |
|
104 |
|
105 |
|
106 |
-
|
107 |
DESCRIPTION = '''
|
108 |
<div>
|
109 |
<h1 style="text-align: center;">Microscopic Mineral Identification App</h1>
|
|
|
87 |
|
88 |
# Get probabilities for all classes
|
89 |
probabilities = loaded_svm_model.predict_proba(image_features)[0]
|
90 |
+
|
91 |
+
# Convert prediction scores to percentages
|
92 |
+
prediction_scores_percentages = [f"{score * 100:.2f}%" for score in probabilities]
|
93 |
+
|
94 |
+
predicted_scores = "\n".join([f"{label}: {score}" for label, score in zip(class_labels, prediction_scores_percentages)])
|
95 |
|
96 |
# Get key facts about the predicted mineral
|
97 |
mineral_key_facts = mineral_facts.get(predicted_class_name, "No key facts available for this mineral.")
|
|
|
103 |
|
104 |
|
105 |
|
|
|
106 |
DESCRIPTION = '''
|
107 |
<div>
|
108 |
<h1 style="text-align: center;">Microscopic Mineral Identification App</h1>
|