Update app.py
Browse files
app.py
CHANGED
|
@@ -104,6 +104,9 @@ class CattleDiseaseClassifier:
|
|
| 104 |
stage = 'no stage'
|
| 105 |
else:
|
| 106 |
stage = stage.strip()
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
# Get description
|
| 109 |
description = entry.get('description', '').strip() if entry.get('description') else 'No description available'
|
|
@@ -290,7 +293,8 @@ class CattleDiseaseClassifier:
|
|
| 290 |
for item in similar_images[:5]:
|
| 291 |
if item['class']:
|
| 292 |
class_votes[item['class']] = class_votes.get(item['class'], 0) + item['similarity']
|
| 293 |
-
|
|
|
|
| 294 |
stage_votes[item['stage']] = stage_votes.get(item['stage'], 0) + item['similarity']
|
| 295 |
|
| 296 |
# Get final prediction
|
|
|
|
| 104 |
stage = 'no stage'
|
| 105 |
else:
|
| 106 |
stage = stage.strip()
|
| 107 |
+
# If class equals stage, it means there's no actual stage
|
| 108 |
+
if stage == class_name:
|
| 109 |
+
stage = 'no stage'
|
| 110 |
|
| 111 |
# Get description
|
| 112 |
description = entry.get('description', '').strip() if entry.get('description') else 'No description available'
|
|
|
|
| 293 |
for item in similar_images[:5]:
|
| 294 |
if item['class']:
|
| 295 |
class_votes[item['class']] = class_votes.get(item['class'], 0) + item['similarity']
|
| 296 |
+
# Only count stage votes if stage is different from class (i.e., actual stage info exists)
|
| 297 |
+
if item['stage'] and item['stage'] != 'no stage' and item['stage'] != item['class']:
|
| 298 |
stage_votes[item['stage']] = stage_votes.get(item['stage'], 0) + item['similarity']
|
| 299 |
|
| 300 |
# Get final prediction
|