Skip to content

Commit bd34e30

Browse files
committed
AI should use score as label
1 parent db2ef92 commit bd34e30

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tigacrafting/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,11 @@ def get_score_fieldnames(cls) -> List[str]:
18131813

18141814
@property
18151815
def confidence(self) -> float:
1816-
return 0.75
1816+
return getattr(
1817+
self,
1818+
f'{self.predicted_class}{self.CLASS_FIELD_SUFFIX}',
1819+
0.0
1820+
) if self.predicted_class else 1.0
18171821

18181822
@property
18191823
def uncertainty(self) -> float:

tigaserver_app/models.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,15 +2359,19 @@ def get_final_combined_expert_category_euro(self) -> str:
23592359
if identification_task.status == IdentificationTask.Status.CONFLICT:
23602360
return "Conflict"
23612361

2362+
suffix = ""
2363+
if identification_task.result_source == IdentificationTask.ResultSource.AI:
2364+
suffix = "({})".format(identification_task.result_source).upper()
2365+
23622366
res = "Other species"
23632367
if identification_task.taxon.is_relevant:
23642368
with translation.override('en'):
2365-
res = "{} {}".format(identification_task.confidence_label, identification_task.taxon.name)
2366-
2367-
if identification_task.result_source == IdentificationTask.ResultSource.AI:
2368-
res = res + " ({})".format(identification_task.result_source)
2369+
res = "{} {}".format(
2370+
identification_task.confidence_label if identification_task.result_source != IdentificationTask.ResultSource.AI else "",
2371+
identification_task.taxon.name
2372+
)
23692373

2370-
return res
2374+
return f"{res} {suffix}".strip()
23712375

23722376
# This is just a formatter of get_final_combined_expert_category_euro_struct. Takes the exact same output and makes it
23732377
# template friendly, also adds explicit ids for category and complex

0 commit comments

Comments
 (0)