Download backend/core/utils.py from abhiraj12/Auto_ML: direct link, hf CLI and curl.
- Browser
- Download file 456 Bytes
-
https://huggingface.co/spaces/abhiraj12/Auto_ML/resolve/main/backend/core/utils.py
- Command line
-
hf download hf://spaces/abhiraj12/Auto_ML/backend/core/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/abhiraj12/Auto_ML/resolve/main/backend/core/utils.py
456 Bytes
| # backend/core/utils.py | |
| from infra.config import CONFIG | |
| def clamp_confidence(value: float) -> float: | |
| """Clamps an AI confidence or similarity score to the max configured value to boost trust.""" | |
| try: | |
| value = float(value) | |
| except Exception: | |
| value = 0.0 | |
| max_conf = CONFIG.get("max_confidence", 100) | |
| try: | |
| max_conf = float(max_conf) | |
| except Exception: | |
| max_conf = 100.0 | |
| return min(max_conf, value) |