File size: 826 Bytes
4fa1caf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import json
import sys
from pathlib import Path
from scorer import score
def main():
if len(sys.argv) != 3:
print("Usage: python cli.py <reference.csv> <predictions.csv>", file=sys.stderr)
sys.exit(1)
reference_path = Path(sys.argv[1])
prediction_path = Path(sys.argv[2])
if not reference_path.exists():
print(f"Reference file not found: {reference_path}", file=sys.stderr)
sys.exit(1)
if not prediction_path.exists():
print(f"Prediction file not found: {prediction_path}", file=sys.stderr)
sys.exit(1)
try:
results = score(reference_path, prediction_path)
except Exception as e:
print(f"Scoring error: {e}", file=sys.stderr)
sys.exit(1)
print(json.dumps(results, indent=2))
if __name__ == "__main__":
main() |