Spaces:
No application file
No application file
| # π Deployment Guide for Hugging Face Spaces | |
| ## Files Created for Deployment | |
| 1. **app.py** - Main Gradio application | |
| 2. **README.md** - Space configuration and documentation | |
| 3. **requirements.txt** - Python dependencies | |
| 4. **packages.txt** - System dependencies for Manim | |
| 5. **.gitignore** - Files to exclude from git | |
| 6. **test_deployment.py** - Local testing script | |
| ## Step-by-Step Deployment Instructions | |
| ### 1. Create a New Hugging Face Space | |
| 1. Go to [Hugging Face Spaces](https://huggingface.co/spaces) | |
| 2. Click "Create new Space" | |
| 3. Choose: | |
| - **Space name**: `ai-video-generator` (or your preferred name) | |
| - **License**: MIT | |
| - **SDK**: Gradio | |
| - **Hardware**: CPU Basic (free tier) or GPU if you have Pro subscription | |
| ### 2. Upload Files | |
| Upload all the files from your video_generator folder: | |
| - `app.py` | |
| - `README.md` | |
| - `requirements.txt` | |
| - `packages.txt` | |
| - `.gitignore` | |
| **DO NOT upload**: | |
| - `.env` file (contains your API key) | |
| - `video_generator.py` (original file, not needed) | |
| ### 3. Set Environment Variables | |
| 1. Go to your Space settings | |
| 2. Click on "Variables and secrets" | |
| 3. Add a new secret: | |
| - **Name**: `GEMINI_API_KEY` | |
| - **Value**: Your actual Gemini API key (from your .env file) | |
| ### 4. Wait for Build | |
| - The space will automatically build and install dependencies | |
| - This may take 5-15 minutes due to Manim installation | |
| - Check the build logs for any errors | |
| ### 5. Test the Application | |
| 1. Once built, test with a simple topic like "Introduction to Python" | |
| 2. Check if videos generate correctly | |
| 3. Verify the interface works smoothly | |
| ## Troubleshooting | |
| ### Common Issues and Solutions | |
| 1. **Build Timeout** | |
| - Manim installation can be slow | |
| - Try using a smaller requirements.txt with fewer versions specified | |
| 2. **Memory Issues** | |
| - Use shorter video durations (1 minute) | |
| - Consider upgrading to GPU hardware | |
| 3. **API Key Issues** | |
| - Double-check the secret name is exactly `GEMINI_API_KEY` | |
| - Verify the API key is valid and has quota | |
| 4. **Video Generation Fails** | |
| - Check the generation logs in the interface | |
| - Manim syntax might need adjustment for the cloud environment | |
| ## Alternative Deployment (GitHub β HF Spaces) | |
| If you prefer using Git: | |
| 1. Create a GitHub repository | |
| 2. Push all files (except .env) | |
| 3. Connect the repository to Hugging Face Spaces | |
| 4. Set the API key in Spaces secrets | |
| ## Performance Tips | |
| 1. **Use shorter durations** (1-2 minutes max) | |
| 2. **Simple topics** work better than complex ones | |
| 3. **Monitor usage** to stay within API limits | |
| 4. **Consider caching** for frequently requested topics | |
| ## Security Notes | |
| - Never commit API keys to public repositories | |
| - Use Hugging Face Spaces secrets for sensitive data | |
| - The .gitignore file excludes sensitive files | |
| ## Support | |
| If you encounter issues: | |
| 1. Check the Space logs | |
| 2. Verify all dependencies in requirements.txt | |
| 3. Test locally first with test_deployment.py | |
| 4. Consider the Hugging Face Spaces documentation | |