Views
No views yet
Generate cricket commentary for this ball: {"ball_in_over": 6, "batting_team": "...", ...}1{
2 "over_number": 0,
3 "ball_in_over": 1,
4 "innings": "1",
5 "batting_team": "Royal Challengers Bengaluru",
6 "bowling_team": "Chennai Super Kings",
7 "striker": "V Kohli",
8 "non_striker": "F du Plessis",
9 "bowler": "DL Chahar",
10 "ball_length": "",
11 "ball_line": "",
12 "shot_played": "",
13 "shot_direction": "",
14 "runs_off_bat": 0,
15 "extras": 0,
16 "wides": "",
17 "noballs": "",
18 "byes": "",
19 "legbyes": "",
20 "wicket": 0,
21 "wicket_type": "",
22 "player_dismissed": "",
23 "runs_so_far": 0,
24 "wickets_so_far": 0,
25 "is_last_ball_of_over": false,
26 "over_number_completed": null,
27 "score_at_end_of_over": ""
28}| Field | Type | Description |
|---|---|---|
over_number | int | Over index (0-based). |
ball_in_over | int | Delivery in over (1–6). |
innings | string | "1" or "2". |
batting_team | string | Batting side name. |
bowling_team | string | Bowling side name. |
striker | string | Batsman on strike (e.g. "V Kohli"). |
non_striker | string | Non-striker. |
bowler | string | Bowler (e.g. "DL Chahar"). |
ball_length | string | e.g. "good length", "full", "short", "yorker", "bouncer". |
ball_line | string | e.g. "outside off", "on off stump", "on leg stump". |
shot_played | string | e.g. "drive", "cut", "leave", "defense". |
shot_direction | string | e.g. "cover", "midwicket", "straight". |
runs_off_bat | int | Runs from bat this ball (0, 1, 4, 6). |
extras | int | Extra runs this ball. |
wides | string | Wide runs if any (e.g. "1.0"), else "". |
noballs | string | No-ball runs if any, else "". |
byes | string | Byes if any, else "". |
legbyes | string | Leg byes if any, else "". |
wicket | int | 1 if wicket this ball, else 0. |
wicket_type | string | e.g. "caught", "bowled", "lbw", or "". |
player_dismissed | string | Dismissed batter or "". |
runs_so_far | int | Team total runs after this ball. |
wickets_so_far | int | Wickets lost after this ball. |
is_last_ball_of_over | bool | true if ball_in_over == 6. |
over_number_completed | int | null | Over that just finished (only when last ball), else null. |
score_at_end_of_over | string | e.g. "45 for 2" when last ball, else "". |
1{
2 "over_number": 0,
3 "ball_in_over": 1,
4 "innings": "1",
5 "batting_team": "Royal Challengers Bengaluru",
6 "bowling_team": "Chennai Super Kings",
7 "striker": "V Kohli",
8 "non_striker": "F du Plessis",
9 "bowler": "DL Chahar",
10 "ball_length": "",
11 "ball_line": "",
12 "shot_played": "",
13 "shot_direction": "",
14 "runs_off_bat": 0,
15 "extras": 1,
16 "wides": "1.0",
17 "noballs": "",
18 "byes": "",
19 "legbyes": "",
20 "wicket": 0,
21 "wicket_type": "",
22 "player_dismissed": "",
23 "runs_so_far": 1,
24 "wickets_so_far": 0,
25 "is_last_ball_of_over": false,
26 "over_number_completed": null,
27 "score_at_end_of_over": ""
28}1{
2 "over_number": 0,
3 "ball_in_over": 6,
4 "innings": "1",
5 "batting_team": "Royal Challengers Bengaluru",
6 "bowling_team": "Chennai Super Kings",
7 "striker": "F du Plessis",
8 "non_striker": "V Kohli",
9 "bowler": "DL Chahar",
10 "ball_length": "good length",
11 "ball_line": "outside off",
12 "shot_played": "drive",
13 "shot_direction": "cover",
14 "runs_off_bat": 4,
15 "extras": 0,
16 "wides": "",
17 "noballs": "",
18 "byes": "",
19 "legbyes": "",
20 "wicket": 0,
21 "wicket_type": "",
22 "player_dismissed": "",
23 "runs_so_far": 6,
24 "wickets_so_far": 0,
25 "is_last_ball_of_over": true,
26 "over_number_completed": 0,
27 "score_at_end_of_over": "6 for 0"
28}dataset/commentary_dataset.csvcommentary or commentary_with_score_line).scripts/train_commentary_model.pySeq2SeqTrainer, AutoModelForSeq2SeqLM, DataCollatorForSeq2Seq)1python scripts/download_flan_t5.py --output-dir models/flan-t5-base
2python scripts/train_commentary_model.py --local-model models/flan-t5-baseoutput/commentary_model/ (or --output-dir) — tokenizer and model weights.--push-to-hub --hub-model-id ashishgimekar/commentary-flan-t5python scripts/generate_commentary.py --model ashishgimekar/commentary-flan-t5 --event-file sample_event.jsonpython scripts/generate_commentary.py --model output/commentary_model --event-file sample_event.json"Generate cricket commentary for this ball: " + json.dumps(event, sort_keys=True), tokenize, call model.generate(...), and decode. Your event-detection step should output one JSON object per ball; pass it to the model to get the commentary string.