ClarusC64's picture
Create cli.py
bac72f9 verified
raw
history blame contribute delete
462 Bytes
import csv
import json
import sys
from scorer import score
def load(path):
with open(path, encoding="utf-8", newline="") as f:
return list(csv.DictReader(f))
if __name__ == "__main__":
if len(sys.argv) != 3:
raise SystemExit("Usage: python cli.py predictions.csv references.csv")
predictions = load(sys.argv[1])
references = load(sys.argv[2])
result = score(predictions, references)
print(json.dumps(result, indent=2))