Skip to main content

OCR and optional Ollama-assisted chess result analyzer

Project description

Chess Result Analyzer Ollama

OCR-first chess screenshot analysis with an optional Ollama vision fallback.

Features

  • Chess.com mobile and desktop result parsing
  • Support for alternative score/result banners like 0-1, 1-0, Black Won, and Game Aborted
  • Importable Python API
  • Desktop GUI uploader
  • Optional Ollama vision refinement for harder screenshots
  • Works with local Ollama or hosted Ollama using OLLAMA_API_KEY

Install

pip install chess-result-analyzer-ollama

You also need the native Tesseract executable installed on your machine.

Python Usage

from chess_result_analyzer import OllamaSettings, analyze_chess_result

result = analyze_chess_result(
    "result.png",
    username="isco-olad",
    ollama=OllamaSettings(
        model="gemma3:4b",
        base_url="http://127.0.0.1:11434",
        mode="fallback",
    ),
)

print(result["winner"], result["winner_color"])

Hosted Ollama

For local Ollama, no API key is needed.

For hosted Ollama, set environment variables:

export OLLAMA_BASE_URL="https://ollama.com"
export OLLAMA_API_KEY="your-key"

Then:

import os

from chess_result_analyzer import OllamaSettings, analyze_chess_result

result = analyze_chess_result(
    "result.png",
    ollama=OllamaSettings(
        model="gemma3:4b",
        base_url="https://ollama.com",
        mode="fallback",
        api_key=os.getenv("OLLAMA_API_KEY"),
    ),
)

When api_key is omitted, the CLI and GUI read OLLAMA_API_KEY from the environment.

CLI

chess-analyze --image result.png --username isco-olad
chess-analyze --image result.png --use-ollama --ollama-model gemma3:4b
chess-analyze-gui

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chess_result_analyzer_ollama-0.1.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chess_result_analyzer_ollama-0.1.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file chess_result_analyzer_ollama-0.1.0.tar.gz.

File metadata

File hashes

Hashes for chess_result_analyzer_ollama-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f638f784838916ffa21da41a1e57684ca2203069c775d3bfbdc43e6843cb79de
MD5 3d8e9ff733bec91ca92550a5951c432a
BLAKE2b-256 06f3282da2628ab676e5f07e666c760b04e21c8e5c343d991dbce1117ddd8606

See more details on using hashes here.

File details

Details for the file chess_result_analyzer_ollama-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chess_result_analyzer_ollama-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21771d8c74e36625327f5d2b470b1d714e3d5f830dd820ef2557ba5f694d528c
MD5 a1c4dffe47e6bbd5ae91341ce7639dab
BLAKE2b-256 a758cb35dc1181b87b4152febc6e1f1b89ea079e2145f4b9bdee12dc6e780208

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page