Skip to content

GOALIE (Game-Observations-Analysis-via-Linguistic-Information-Extraction) is a Chrome extension that delivers real-time football commentary insights using AI. It classifies live commentary with NLP and generates tactical snippets via a Flask + Gradio backend.

License

Notifications You must be signed in to change notification settings

16kushaal/GOALIE-Live-Sports-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšฝ GOALIE โ€“ Game-Observations-Analysis-via-Linguistic-Information-Extraction

Real-Time Match Insights from Commentators Narration โ€“ All in Your Browser.

GOALIE is a browser extension (designed for Chromium) that simulates real-time football match updates, complete with AI-powered snippet generation, tactical commentary classification, and interactive match displays. It features a sleek UI and integrates with a Flask-based backend that talks to a Gradio-hosted classifier.


Features

  • ๐ŸŽฎ Live Match Simulation with realistic minute-by-minute commentary (For Demostartion Purposes)
  • ๐Ÿ’ฌ AI-Generated Snippets describing the current game state
  • ๐Ÿ” NLP Classification of football commentary using Hugging Face + Gradio
  • ๐Ÿง  Event Detection for goals, fouls, corners, substitutions, and more
  • โš™๏ธ Configurable Match Data (currently with limited commentary, in production using SportsMonk API (Extension Under Development))
  • ๐ŸŒ™ Dark Themed UI with smooth animations and responsive layout

๐Ÿ“Š System Pipeline Diagram

GOALIE Pipeline

Tech Stack

Layer Technology
Frontend HTML, CSS (custom + variables), JavaScript
UI Libraries Feather Icons, Google Fonts (Inter)
Backend Python, Flask, Flask-CORS
AI/NLP Hugging Face Transformers (via Gradio client)
Hosting Local Flask server + Gradio space endpoint

Model Benchmarking & Evaluation

GOALIE classifies football commentary into 3 categories โ€” CURRENT, PAST, and IRRELEVANT โ€” using supervised NLP techniques.


Dataset

  • Source: SoccerNet-Echoes (whisper_v3/en)
  • Processed version: football_commentary_balanced.csv (balanced to 50,000 samples/class)
  • Final shape: 149,981 samples
  • Columns: game, text, label

Used only English commentary. Filtered and balanced across the 3 label classes.


Top 10 Model Combinations

Rank Model Vectorizer Accuracy F1 Score CV Score (ยฑstd) Time (s)
1 Logistic Regression TF-IDF (Char 2-5) 0.9966 0.9966 0.9959 ยฑ 0.000 135.03
2 Random Forest TF-IDF (Char 2-5) 0.9873 0.9874 0.9889 ยฑ 0.001 266.37
3 Logistic Regression Count (1-2gram) 0.9790 0.9790 0.9791 ยฑ 0.001 21.72
4 Logistic Regression TF-IDF (1-3gram) 0.9789 0.9789 0.9774 ยฑ 0.001 17.25
5 Logistic Regression TF-IDF (1-2gram) 0.9773 0.9773 0.9757 ยฑ 0.001 15.50
6 Random Forest TF-IDF (1-2gram) 0.9340 0.9336 0.9351 ยฑ 0.002 22.90
7 Random Forest TF-IDF (1-3gram) 0.9332 0.9329 0.9322 ยฑ 0.000 25.37
8 Naive Bayes TF-IDF (Char 2-5) 0.9331 0.9328 0.9341 ยฑ 0.001 108.53
9 Random Forest Count (1-2gram) 0.9315 0.9312 0.9329 ยฑ 0.001 30.64
10 Naive Bayes TF-IDF (1-3gram) 0.8689 0.8646 0.8640 ยฑ 0.002 14.73

Best Performing Model

Model     : Logistic Regression
Vectorizer: TF-IDF (Character-level, 2โ€“5)
Accuracy  : 0.9966
F1 Score  : 0.9966
CV Score  : 0.9959 ยฑ 0.000

Setup Instructions

1. Clone the repository

git clone https://github.com/16kushaal/GOALIE-Live-Sports-Extension.git
cd GOALIE-Live-Sports-Extension

2. Backend Setup (app.py)

โš ๏ธ Ensure you have Python 3.8+ and pip installed.

pip install Flask Flask-Cors python-dotenv gradio_client

Create a .env file in the root directory:

GRADIO_SPACE=<your_gradio_space_url>
HF_TOKEN=<your_huggingface_token>

Then run:

python app.py

Your API will be hosted at http://127.0.0.1:5000/classify_and_log


3. Frontend / Chrome Extension Setup

Load Extension

  1. Open Chrome โ†’ chrome://extensions
  2. Enable Developer Mode
  3. Click Load unpacked โ†’ select the repo folder

Ensure the following file exists and is correct:

manifest.json

Insert Gemini API Key (Frontend)

In popup.js, replace:

const GEMINI_API_KEY = 'ADD_YOUR_GEMINI_API_HERE';

with your actual API key, or handle it through a proxy if sensitive.


Project Structure

FOOTBALL-SCORE-EXTENSION/
โ”‚
โ”œโ”€โ”€ .venv/                          # Python virtual environment
โ”œโ”€โ”€ .env                            # Environment variables (Gradio + HuggingFace tokens)
โ”œโ”€โ”€ README.md                       # Project documentation
โ”œโ”€โ”€ app.py                          # Flask backend server (text classification + Gradio client)
โ”œโ”€โ”€ text.txt                        # Match event commentary samples
โ”‚
โ”œโ”€โ”€ football-live-extension/       # Chrome Extension Source
โ”‚   โ”œโ”€โ”€ manifest.json              # Chrome Extension manifest (v3)
โ”‚   โ”œโ”€โ”€ popup.html                 # Main popup UI HTML
โ”‚   โ”œโ”€โ”€ popup.css                  # Extension styling (themed, responsive)
โ”‚   โ”œโ”€โ”€ popup.js                   # Frontend logic, AI snippet updates, match selection
โ”‚   โ””โ”€โ”€ images/                    # Logos/icons (48x48, etc.)
โ”‚
โ”œโ”€โ”€ model/                         # ML-related assets
โ”‚   โ”œโ”€โ”€ data/                      # Labeled and balanced datasets
โ”‚   โ”‚   โ”œโ”€โ”€ football_commentary_labelled.csv
โ”‚   โ”‚   โ””โ”€โ”€ football_commentary_balanced.csv
โ”‚   โ”œโ”€โ”€ results/                   # Outputs (model + visualizations)
โ”‚   โ”‚   โ””โ”€โ”€ output.png             # Example plot/metric image
โ”‚   |โ”€โ”€ football_classifier_model.pkl
โ”‚   โ”œโ”€โ”€ dataset.ipynb             # Preprocessing, balancing, and exploration
โ”‚   โ””โ”€โ”€ model.ipynb               # Training and evaluation of the classifier


โš™๏ธ How It Works

  1. User selects a match from the popup.

  2. Commentary events simulate live match progression every few seconds.

  3. Commentary is sent via fetch() to Flask (/classify_and_log) where:

    • It's processed by a Gradio-hosted transformer model
    • The classification (Current, Past, Irrelevant) is logged and printed
  4. The popup UI updates the snippet and events visually based on the result.


Demo Commentary Types

{
  "type": "commentary", "text": "Dembรฉlรฉ hits the post! That was close!"
}
{
  "type": "score", "scorer": "Mbappรฉ", "team": "home", "newScore": [1, 0]
}
{
  "type": "foul", "text": "Yellow card for Caicedo."
}

๐Ÿ“‹ Todo / Roadmap

  • Add real-time data API support (from SportsMonk)
  • Improve snippet generation using Gemini API (currently simulated)
  • Save commentary logs to a database
  • Add user team preferences and theming
  • Dockerize backend for production deployment

How to run it

1๏ธโƒฃ Clone the Repository (if not already)

git clone https://github.com/16kushaal/GOALIE-Live-Sports-Extension
cd GOALIE-Live-Sports-Extension

2๏ธโƒฃ Create and Activate Virtual Environment

3๏ธโƒฃ Install Required Python Packages

pip install -r requirements.txt

4๏ธโƒฃ Download spaCy Model

python -m spacy download en_core_web_sm

5๏ธโƒฃ Configure Environment Variables

Create a .env file in your root directory and add the following:

GRADIO_SPACE=<your_gradio_space_url>
HF_TOKEN=<your_huggingface_token>

6๏ธโƒฃ Run the Server

python app.py


Working Demo Video

Tap to watch the Demo Video


Author

Made with โšฝ and ๐Ÿ’ป by @16kushaal


๐Ÿ“„ License

Apache-2.0 license. See LICENSE for more information.


About

GOALIE (Game-Observations-Analysis-via-Linguistic-Information-Extraction) is a Chrome extension that delivers real-time football commentary insights using AI. It classifies live commentary with NLP and generates tactical snippets via a Flask + Gradio backend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published