Download src/evaluation/consistency_tests.py from pratik-250620/MultiModal-Coherence-AI: direct link, hf CLI and curl.
- Browser
- Download file 695 Bytes
-
https://huggingface.co/spaces/pratik-250620/MultiModal-Coherence-AI/resolve/main/src/evaluation/consistency_tests.py
- Command line
-
hf download hf://spaces/pratik-250620/MultiModal-Coherence-AI/src/evaluation/consistency_tests.py
-
curl -L -o consistency_tests.py https://huggingface.co/spaces/pratik-250620/MultiModal-Coherence-AI/resolve/main/src/evaluation/consistency_tests.py
695 Bytes
| from __future__ import annotations | |
| from typing import Dict, List | |
| def human_alignment_score(human_criteria: Dict[str, bool]) -> float: | |
| """ | |
| Simple proxy score: % of human criteria satisfied. | |
| """ | |
| values = list(human_criteria.values()) | |
| return sum(values) / len(values) | |
| def compare_human_vs_msci(results: List[Dict]): | |
| diffs = [] | |
| for result in results: | |
| human_score = human_alignment_score(result["human"]) | |
| diffs.append( | |
| { | |
| "id": result["id"], | |
| "human_score": human_score, | |
| "msci": result["msci"], | |
| "delta": result["msci"] - human_score, | |
| } | |
| ) | |
| return diffs | |