Spaces:
Runtime error
Runtime error
Refactor video processing pipeline to integrate new agents for content analysis, enhancement, and thumbnail strategy generation. Implement frame extraction functionality and streamline agent initialization. Update app structure to support enhanced thumbnail generation with AI-driven strategies, improving overall workflow and user experience.
35e1a54 |
Download documentation/deployment-guide.md from Agents-MCP-Hackathon/TubeGenius: direct link, hf CLI and curl.
- Browser
- Download file 6.59 kB
-
https://huggingface.co/spaces/Agents-MCP-Hackathon/TubeGenius/resolve/main/documentation/deployment-guide.md
- Command line
-
hf download hf://spaces/Agents-MCP-Hackathon/TubeGenius/documentation/deployment-guide.md
-
curl -L -o deployment-guide.md https://huggingface.co/spaces/Agents-MCP-Hackathon/TubeGenius/resolve/main/documentation/deployment-guide.md
6.59 kB
| # ๐ Deployment Guide - Improved Thumbnail System | |
| ## ๐ **Overview** | |
| This guide walks you through deploying the improved AI-driven thumbnail generation system to your YouTube Content Optimizer. | |
| ## โ **Prerequisites** | |
| ### **Environment Setup** | |
| - Ensure your `.env` file contains: | |
| ``` | |
| MODEL_ENDPOINT=<your_ollama_endpoint> | |
| MODEL_NAME=<your_model_name> | |
| YOUTUBE_API_KEY=<your_youtube_api_key> | |
| ``` | |
| ### **Dependencies** | |
| - All existing dependencies are compatible | |
| - No new packages required (uses existing LlamaIndex + Ollama setup) | |
| ## ๐งช **Pre-Deployment Testing** | |
| ### **1. Test the ThumbnailStrategyAgent Locally** | |
| ```bash | |
| cd /path/to/SmartThumbnailer | |
| python tests/test_thumbnail_strategy_agent.py | |
| ``` | |
| **Expected Output:** | |
| ``` | |
| โ Generated 4 strategies | |
| โ Strategy 1 validation passed | |
| โ Strategy 2 validation passed | |
| โ Strategy 3 validation passed | |
| โ Strategy 4 validation passed | |
| ๐ ThumbnailStrategyAgent test completed successfully! | |
| ``` | |
| ### **2. Verify Syntax of All Modified Files** | |
| ```bash | |
| python -m py_compile app.py | |
| python -m py_compile agents/thumbnail_strategy_agent.py | |
| python -m py_compile modal_deployments/modal_functions.py | |
| ``` | |
| All should complete without errors. | |
| ## ๐ **Deployment Steps** | |
| ### **Step 1: Deploy Updated Modal Functions** | |
| ```bash | |
| cd modal_deployments | |
| modal deploy modal_functions.py | |
| ``` | |
| **What this does:** | |
| - Deploys the new simplified `generate_thumbnails` function | |
| - Function now accepts AI-generated strategies instead of raw content | |
| - Removes 200+ lines of hardcoded prompt generation logic | |
| ### **Step 2: Restart Local Application** | |
| ```bash | |
| cd .. | |
| python app.py | |
| ``` | |
| **What's different:** | |
| - New ThumbnailStrategyAgent integrated into workflow | |
| - Step 7 now split into 7a (strategy generation) and 7b (image generation) | |
| - Enhanced UI showing AI-identified themes and visual hooks | |
| ### **Step 3: Test End-to-End Workflow** | |
| 1. Upload a test video file | |
| 2. Watch the processing steps | |
| 3. Verify new step messages: | |
| - "โ Generated 4 AI thumbnail strategies" | |
| - "๐ฏ AI-identified themes: [themes]" | |
| - "๐จ AI visual hooks: [hooks]" | |
| ## ๐ **Validation Checklist** | |
| ### **UI Improvements** โ | |
| - [ ] Step 7 shows "Generating AI-strategic thumbnails" | |
| - [ ] Status displays strategy count (e.g., "Generated 4 AI thumbnail strategies") | |
| - [ ] AI-identified themes shown in results | |
| - [ ] Visual hooks displayed in results | |
| ### **Functionality** โ | |
| - [ ] Video upload and processing works | |
| - [ ] All 7 steps complete successfully | |
| - [ ] 4 thumbnails generated (or appropriate number based on strategies) | |
| - [ ] Thumbnails are relevant to video content | |
| - [ ] No hardcoded style names in logs | |
| ### **Performance** โ | |
| - [ ] Strategy generation completes locally (faster) | |
| - [ ] Modal function focuses only on image generation | |
| - [ ] Overall processing time maintained or improved | |
| ## ๐ **Troubleshooting** | |
| ### **Common Issues** | |
| #### **"Environment variables not set" Error** | |
| ```bash | |
| # Check your .env file contains: | |
| MODEL_ENDPOINT=http://your_ollama_server:11434 | |
| MODEL_NAME=llama2 # or your preferred model | |
| ``` | |
| #### **"ThumbnailStrategyAgent: Invalid response format" Warning** | |
| - The agent will automatically use fallback strategies | |
| - Check your Ollama model supports JSON mode | |
| - Verify model endpoint is accessible | |
| #### **Modal Function Import Errors** | |
| ```bash | |
| # Re-deploy Modal functions: | |
| cd modal_deployments | |
| modal deploy modal_functions.py | |
| ``` | |
| #### **"Missing 'thumbnail_strategies' key" Error** | |
| - Indicates local strategy generation failed | |
| - System will use fallback strategies | |
| - Check Ollama service is running and accessible | |
| ### **Debugging Steps** | |
| 1. **Check Local Agent First:** | |
| ```bash | |
| python tests/test_thumbnail_strategy_agent.py | |
| ``` | |
| 2. **Verify Modal Deployment:** | |
| ```bash | |
| modal ls | |
| # Should show "youtube-content-optimizer" app | |
| ``` | |
| 3. **Check Logs:** | |
| - Local agent logs in terminal output | |
| - Modal function logs in Modal dashboard | |
| ## ๐ **Performance Monitoring** | |
| ### **Key Metrics to Watch** | |
| #### **Strategy Generation (Local)** | |
| - Time to generate 4 strategies: ~30-60 seconds | |
| - Success rate: Should be >95% with fallback | |
| - Strategy quality: Strategies should be contextually relevant | |
| #### **Image Generation (Modal)** | |
| - Time per thumbnail: ~10-15 seconds | |
| - Success rate: Should match previous system | |
| - Image quality: Should maintain or improve | |
| ### **Optimization Tips** | |
| 1. **For Faster Strategy Generation:** | |
| - Use a faster Ollama model (e.g., `llama2-7b` vs `llama2-70b`) | |
| - Ensure Ollama server has adequate resources | |
| 2. **For Better Strategy Quality:** | |
| - Use a larger, more capable model | |
| - Ensure competitive analysis data is comprehensive | |
| ## ๐ฏ **Success Criteria** | |
| ### **Deployment Successful When:** | |
| - [x] All tests pass without errors | |
| - [x] Modal deployment completes successfully | |
| - [x] End-to-end video processing works | |
| - [x] Thumbnails are relevant to video content | |
| - [x] UI shows AI strategy insights | |
| - [x] Performance is maintained or improved | |
| ### **Quality Validation:** | |
| - Upload a test video on a familiar topic | |
| - Verify generated thumbnails match the content theme | |
| - Check that text overlays use parts of the optimized title | |
| - Confirm visual elements reflect competitive insights | |
| ## ๐ฎ **Post-Deployment** | |
| ### **Immediate Actions** | |
| 1. Test with 2-3 different video types | |
| 2. Verify thumbnail relevance and quality | |
| 3. Monitor performance metrics | |
| 4. Document any issues for optimization | |
| ### **Future Enhancements** | |
| 1. Collect user feedback on thumbnail effectiveness | |
| 2. A/B test different strategy approaches | |
| 3. Analyze which strategies generate best results | |
| 4. Consider adding brand guideline integration | |
| ## ๐ **Rollback Plan** | |
| If issues occur, you can quickly rollback: | |
| ### **1. Revert Modal Function** | |
| ```bash | |
| # Keep a backup of the original modal_functions.py | |
| # Restore from git if needed: | |
| git checkout HEAD~1 -- modal_deployments/modal_functions.py | |
| modal deploy modal_functions.py | |
| ``` | |
| ### **2. Revert Local Application** | |
| ```bash | |
| # Restore app.py to use old thumbnail generation: | |
| git checkout HEAD~1 -- app.py | |
| ``` | |
| ### **3. Remove New Agent (if needed)** | |
| ```bash | |
| # Remove new agent import: | |
| # Edit app.py to remove ThumbnailStrategyAgent import and usage | |
| ``` | |
| --- | |
| ## ๐ **Ready to Deploy!** | |
| The improved system is designed to be a drop-in replacement with significant quality improvements. Follow the steps above and you'll have an AI-driven, contextually relevant thumbnail generation system that leverages all available video and competitive intelligence. | |
| **Next:** Deploy and test with real video content! ๐ |