# BAKO-AI Deployment Guide This guide explains how to manage and deploy the BAKO-AI analysis pipeline to Hugging Face. ## 🏗 Architecture Overview - **Application**: Hosted on Hugging Face Spaces (`icanedit2/BakoAI`). - **Models**: Hosted on a dedicated Hugging Face Model Repository (`icanedit2/bakoai-models`). - **Storage/DB**: Managed via Supabase. ## 🚀 Deployment Workflow ### 1. Push Code Changes To push local changes from the `back-end` folder to the Hugging Face Space root: ```bash # From the root directory: git subtree split --prefix back-end -b hf-production-build git push hf hf-production-build:main --force git branch -D hf-production-build ``` ### 🧠 2. Managing Models Models are stored in the `icanedit2/bakoai-models` repository to prevent `git push` from deleting them. - To add a new model, upload it to the `bakoai-models` repo. - Update `download_models.py` in the Space repo to include the new filename. - The build process will automatically download models into `/home/user/app/models/`. ### 🔐 3. Security (Hugging Face Secrets) Ensure the following Secrets are set in your Space Settings: - `HF_TOKEN`: Required for downloading models from private repositories. - `SUPABASE_URL`: Your Supabase project URL. - `SUPABASE_KEY`: Your Supabase anonymous/service key. - `JWT_SECRET`: For authentication. ## 🎬 Video Playback Optimization All annotated videos are processed through FFmpeg with the following settings for maximum browser compatibility: - **Codec**: libx264 - **Pixel Format**: yuv420p - **Dimensions**: Forced to even values (H.264 requirement) - **Streaming**: `+faststart` enabled for instant playback.