Riccchmond/AI-Javelin-Coach
0
๐ AI Javelin Coach
This is an AI-powered application to analyze javelin throw biomechanics.
How to Use:
- Upload a video of a javelin throw.
- Enter the athlete's height (in meters) and weight (in kilograms).
- Click "Analyze Throw" and wait for the analysis to complete.
- A personalized AI video coach will appear with feedback.
AI Javelin Coach
A comprehensive javelin throw analysis application that uses computer vision and AI to provide personalized coaching feedback.
Architecture
The application is built as a single Flask application that serves both the frontend interface and handles biomechanical analysis using OpenCV and MediaPipe, with AI-powered video coaching via Tavus.io.
Setup Instructions
Prerequisites
- Python 3.8+
- pip (Python package manager)
Installation
- Install Python dependencies:
pip install -r requirements.txt- Configure environment variables: Set the following environment variables:
TAVUS_API_KEY- Your Tavus.io API keyREPLICA_ID- Your Tavus replica IDGEMINI_API_KEY- Your Google Gemini API key (optional, for enhanced LLM feedback)
Running the Application
python app.pyAccess the Application
- Open your browser and navigate to
http://localhost:7860(or the port specified in your environment)
Features
- Video Upload: Support for MP4, AVI, MOV, MKV, WEBM formats (up to 100MB)
- Biomechanical Analysis: Real-time pose estimation and angle calculation
- AI Coaching: Personalized video feedback using Tavus.io
- Single Application: Consolidated Flask backend serving both frontend and analysis
API Endpoints
Flask Application (Port 7860)
GET /- Main application interfacePOST /analyze_video- Complete analysis and video generation endpointGET /health- Health check endpointGET /test_analysis- Test endpoint with sample data
Environment Variables
Docker Deployment
The application includes a Dockerfile for containerized deployment:
docker build -t javelin-coach .
docker run -p 7860:7860 javelin-coachHugging Face Spaces Deployment
This application is optimized for deployment on Hugging Face Spaces:
- Create a new Space on Hugging Face
- Choose "Docker" as the SDK
- Upload all files including the Dockerfile
- Set your environment variables in the Space settings
- The application will automatically build and deploy
Troubleshooting
Video Analysis Issues
- Ensure video files are in supported formats
- Check file size limits (100MB max)
- Verify MediaPipe and OpenCV are properly installed
- For optimal results, use videos 10 seconds or less
API Configuration
- Ensure
TAVUS_API_KEYandREPLICA_IDare properly set - Check that your Tavus.io account has sufficient credits
- Verify API keys are valid and not expired
Development Notes
- The application includes fallback analysis when computer vision processing fails
- Tavus video generation requires valid API credentials
- The system gracefully handles errors and provides meaningful feedback to users
