methestrikerx100 commited on
Commit
8e31b74
·
verified ·
1 Parent(s): 6572cc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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
- prediction_scores = [
91
- f"{label}: {prob:.4f}"
92
- for label, prob in zip(class_labels, probabilities)
93
- ]
94
- predicted_scores = "\n".join(prediction_scores)
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>