A web application that converts natural language questions about Premier League soccer data into SQL queries using Google's Gemini AI model.
- Natural language to SQL query conversion
- Real-time database querying
- Automatic data visualization
- Comprehensive Premier League statistics
- Clean and intuitive user interface
- Python 3.8 or higher
- MariaDB server
- Google Gemini API key
- Fantasy Premier League API access
- Clone the repository:
git clone https://github.com/yourusername/natural-language-soccer-query.git
cd natural-language-soccer-query- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt-
Set up the database:
- Install MariaDB if not already installed
- Create a new database named 'fpl'
- Update the database credentials in
mariadb_access.py
-
Configure the Gemini API key:
- Get an API key from Google AI Studio
- Update the
gemini_api_keyvariable ingemini_api.py
-
Initialize the database with Premier League data:
python update_db.py- Start the Flask application:
python app.py- Open your web browser and navigate to:
http://localhost:5000
- Enter your question about Premier League data in the input box
- Toggle visualization if desired
- Click "Submit Query" to see the results
natural-language-soccer-query/
├── app.py # Main Flask application
├── gemini_api.py # Gemini API interface
├── mariadb_access.py # Database access
├── update_db.py # Database update script
├── static/
│ ├── css/
│ │ └── style.css # Styling
│ └── js/
│ └── main.js # Frontend functionality
└── templates/
├── index.html # Main page
├── about.html # About page
├── dataset.html # Dataset information
└── paper.html # Research paper
- "Who are the top 5 goal scorers this season?"
- "Which team has the most clean sheets?"
- "Show me players with more than 5 assists"
- "What is the average goals per game for each team?"
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Fantasy Premier League API for providing the data
- Google Gemini AI for natural language processing
- Flask framework for web application development