| from __future__ import annotations |
|
|
| import argparse |
| import json |
|
|
| from la_liga_score_predictor import LaLigaScorePredictor |
|
|
|
|
| def parse_args() -> argparse.Namespace: |
| parser = argparse.ArgumentParser(description="Run a single football match prediction.") |
| parser.add_argument("--home-team", required=True, help="Home team name") |
| parser.add_argument("--away-team", required=True, help="Away team name") |
| parser.add_argument("--match-date", required=True, help="Match date in YYYY-MM-DD or YYYY/MM/DD") |
| parser.add_argument( |
| "--dataset-csv", |
| default="sample_history.csv", |
| help="Path to compatible historical match CSV (default: sample_history.csv)", |
| ) |
| parser.add_argument( |
| "--pretty", |
| action="store_true", |
| help="Pretty-print JSON output", |
| ) |
| return parser.parse_args() |
|
|
|
|
| def main() -> None: |
| args = parse_args() |
| predictor = LaLigaScorePredictor.from_defaults(dataset_csv_path=args.dataset_csv) |
| result = predictor.predict_match( |
| home_team=args.home_team, |
| away_team=args.away_team, |
| match_date=args.match_date, |
| ) |
| if args.pretty: |
| print(json.dumps(result, indent=2, ensure_ascii=True)) |
| else: |
| print(json.dumps(result, ensure_ascii=True)) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|