LiberoSports/FPLAIManager
FPL AI Manager
FPL AI Manager is a Gradio application for season-long Fantasy Premier League decision support. It retrieves and validates current public data from the official Fantasy Premier League API, then keeps facts, analytics, optimisation, simulations, decision memory, and conversational explanation in deliberately separate layers. [1]
Data principle: official FPL facts and deterministic model outputs are shown separately. The chat assistant receives only a structured evidence bundle and is not permitted to invent statistics, fixtures, injuries, prices, or set-piece assignments.
Product capabilities
Run locally
Use Python 3.11 or later. The commands below create an isolated environment, install all declared requirements, and run the Space launch command.
cd fpl-ai-manager
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.pyGradio normally serves the interface at http://127.0.0.1:7860. Select Refresh official FPL data to bypass the 15-minute cache. The first dashboard load builds a legal modelled squad from the current official snapshot.
Configuration
Copy the template only for local work. Never commit actual secrets.
cp .env.example .envValidate before deployment
The offline tests do not depend on FPL network availability. The diagnostic and dashboard smoke test then exercise the current public API contract and full analytical bundle.
pytest -q
python scripts/validate_fpl_api.py --refresh
python scripts/smoke_dashboard.pyTo inspect entry-specific endpoint availability for a public FPL team, pass an explicit team ID. Pre-season picks can legitimately be unavailable before the official game exposes them; the client reports that condition rather than producing a fabricated squad.
python scripts/validate_fpl_api.py --refresh --entry-id YOUR_FPL_TEAM_IDDeploy to Hugging Face Spaces
Create a new Gradio Space on Hugging Face, clone its repository, and copy this project's files into the cloned repository root.
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
cp -R fpl-ai-manager/. YOUR_SPACE_NAME/
cd YOUR_SPACE_NAME
git add .
git commit -m "Deploy FPL AI Manager"
git pushHugging Face reads the YAML metadata at the top of this README, installs requirements.txt, and starts app.py. The official FPL API is public and therefore needs no secret. To enable chat, add OPENAI_API_KEY and optionally LLM_MODEL through Space Settings → Variables and secrets; do not put them in the repository.
Choose season-memory storage before production
A long-running manager needs a durable state location. Choose one of the following paths before relying on preferences or decision history; then set FPL_STATE_DB accordingly.
The default repository-local .data directory is suitable for development only. It must not be treated as production season memory on non-persistent Space disk.
Current product boundaries
The application intentionally does not claim information it cannot verify. As of the current pre-season FPL response, the underlying performance model is low confidence until official current-season minutes accumulate. The Set Pieces tab remains source-gated until an explicitly sourced provider is configured. The transfer dashboard analyses the modelled initial squad; connecting a user’s official entry requires entering a public entry ID once the FPL picks endpoint is available for the gameweek. These boundaries are explicit rather than silently filled with speculation.
Detailed data contracts, scoring methodology, optimisation rules, scenario design, memory design, and source-provenance rules are in `docs/architecture.md`.
References
[1] Official Fantasy Premier League API — current bootstrap data
