Environment Setup

  1. Clone and set up the repository:
git clone https://github.com/Shard-AI/Shard.git
cd Shard
  1. Configure your virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env

Edit .env with your credentials:

GEMINI_API_KEY=your_gemini_api_key_here
REDIS_HOSTNAME=localhost
REDIS_PORT=6379

Running the Services

Run the API and asynchronous worker in two seperate terminals:

API Server

uvicorn src.app:app --host 0.0.0.0 --port 8000 --reload

Async Worker

celery -A src.core.async_worker worker --loglevel=info --pool=threads

API Testing

Test the API directly using curl:

curl --request POST -F "video=@path/to/your/video.mp4" http://localhost:8000/v1/interpret

SDK Usage

from src.sdk import Shard

client = Shard("your_api_key_here")

# Video interpretation
response = client.interpret("path/to/video.mp4")

# Prompt adherence analysis
analysis = client.gauge_prompt_adherance("path/to/video.mp4", "your prompt here")

Supported File Types

The API accepts the following video formats:

  • MP4 (.mp4)
  • MPEG (.mpeg)
  • MOV (.mov)
  • AVI (.avi)
  • FLV (.flv)
  • MPG (.mpg)
  • WebM (.webm)
  • WMV (.wmv)
  • 3GPP (.3gp)