Skip to content

Aggregate multiple GameChanger baseball and softball box scores.

Notifications You must be signed in to change notification settings

eeg3/gc-stat-aggregator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GC Stat Aggregator

This application allows users to upload images of softball game statistics from GameChanger, extract the player stats using Google Cloud Vision, and then generate a summary of the stats using Google Gemini.

By default, GameChanger provides visibility to individual baseball and softball box scores for specific games, but does not provide any aggregation across multiple games (except for your own team). This application is designed to fill that gap by parsing multiple box scores and generating a summary of the stats.

Usage

The application expects screenshots of the GameChanger box scores starting, at minimum, with the header row (LINEUP, AB, R, H, RBI, BB, SO) then including all of the individual player rows and excluding the team summary row. Example screenshots can be found in the examples/ directory. Upload all screenshots at once, and the application will process them all in parallel.

Required Packages & Software

  • Python 3.11 or higher
  • pip (Python package installer)
  • Google Cloud SDK (for deployment to Google Cloud Run)
  • A Google Cloud Platform project with the Vision API and Gemini API enabled
  • A Gemini API key

The required Python packages are listed in requirements.txt:

  • Flask
  • google-cloud-vision
  • google-generativeai
  • werkzeug

How to Run

  1. Clone the repository:

    git clone <repository_url>
    cd <repository_directory>
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required packages:

    pip install -r requirements.txt
  4. Set your Gemini API key as an environment variable. Create a .env file in the root directory and add the following line, replacing your_gemini_api_key with your actual key:

    GEMINI_API_KEY=your_gemini_api_key
    
  5. Run the application:

    python main.py

    The application will start on http://0.0.0.0:8080/. Open this address in your web browser to access the application.

Deploying to Google Cloud Run

  1. Make sure you have the Google Cloud SDK installed and configured.

  2. Build and deploy the application to Google Cloud Run using the following command:

    gcloud run deploy gc-stat-aggregator \
        --source . \
        --region us-central1 \
        --platform managed \
        --allow-unauthenticated \
        --memory 512Mi \
        --cpu 1 \
        --set-env-vars GEMINI_API_KEY=your_gemini_api_key

    Replace your_gemini_api_key with your actual Gemini API key. This command will:

    • Deploy the application to Google Cloud Run
    • Set the region to us-central1
    • Allow unauthenticated access to the application
    • Allocate 512MB of memory and 1 CPU to the application
    • Set the GEMINI_API_KEY environment variable

    After deployment, Google Cloud Run will provide a URL to access the application.

License

This project is licensed under the Apache 2.0 License.

About

Aggregate multiple GameChanger baseball and softball box scores.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published