Spaces:
Running
Running
| from dataset.problem_16.helpers import normalize_scores | |
| def top_label(scores: dict[str, float]) -> str: | |
| """Return label with highest normalized probability.""" | |
| labels = list(scores.keys()) | |
| probs = normalize_scores(list(scores.values())) | |
| # BUG: chooses min instead of max. | |
| idx = min(range(len(probs)), key=lambda i: probs[i]) | |
| return labels[idx] | |