ClarusC64's picture
Create cli.py
4fa1caf verified
raw
history blame contribute delete
826 Bytes
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()