ClarusC64 commited on
Commit
bac72f9
·
verified ·
1 Parent(s): 0e98ca1

Create cli.py

Browse files
Files changed (1) hide show
  1. cli.py +18 -0
cli.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import json
3
+ import sys
4
+ from scorer import score
5
+
6
+ def load(path):
7
+ with open(path, encoding="utf-8", newline="") as f:
8
+ return list(csv.DictReader(f))
9
+
10
+ if __name__ == "__main__":
11
+ if len(sys.argv) != 3:
12
+ raise SystemExit("Usage: python cli.py predictions.csv references.csv")
13
+
14
+ predictions = load(sys.argv[1])
15
+ references = load(sys.argv[2])
16
+
17
+ result = score(predictions, references)
18
+ print(json.dumps(result, indent=2))