A powerful movie answer engine leveraging AI agents for real-time search and clip generation.
- Natural language query understanding
- Scene-level search with semantic understanding
- Character and dialogue-based search
- Emotion and action recognition
- Context-aware results
- Automatic scene detection
- High-quality clip generation
- Smooth scene transitions
- Video stabilization
- Quality optimization
- Crew of specialized AI agents
- Efficient resource management
- Smart caching system
- Error recovery mechanisms
sainma/
├── sainma/ # Main package
│ ├── agents/ # AI Agents
│ │ ├── chief_agent.py # Coordination and planning
│ │ ├── movie_expert.py # Movie knowledge
│ │ ├── visual_analyst.py # Visual analysis
│ │ ├── dialogue_expert.py # Dialogue processing
│ │ └── clip_director.py # Clip generation
│ │
│ ├── search/ # Search System
│ │ ├── query_processor.py # Query understanding
│ │ ├── scene_indexer.py # Scene indexing
│ │ └── search_engine.py # Search coordination
│ │
│ ├── clips/ # Clip Generation
│ │ ├── frame_extractor.py # Frame processing
│ │ ├── scene_detector.py # Scene detection
│ │ └── clip_generator.py # Clip creation
│ │
│ ├── coordination/ # System Coordination
│ │ ├── coordinator.py # Main coordinator
│ │ ├── resource_manager.py # Resource management
│ │ ├── cache_manager.py # Caching system
│ │ ├── error_handler.py # Error handling
│ │ └── context_manager.py # Context sharing
│ │
│ └── utils/ # Utilities
│ └── logger.py # Logging system
│
├── tests/ # Test Suite
│ ├── test_search.py # Search tests
│ ├── test_clips.py # Clip tests
│ └── test_coordination.py # Coordination tests
│
├── data/ # Data Directory
│ ├── movies/ # Movie files
│ ├── cache/ # Cache storage
│ ├── index/ # Search indices
│ └── clips/ # Generated clips
│
└── logs/ # Log files
- Clone the repository:
git clone https://github.com/yourusername/sainma.git
cd sainma
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Copy and configure environment variables:
cp .env.example .env
# Edit .env with your configuration
- Start the system:
from sainma.coordination.coordinator import SainmaCoordinator
coordinator = SainmaCoordinator()
# Search for a scene
results = coordinator.search("Show me the fight scene between Iron Man and Thanos")
# Generate a clip
clip = coordinator.generate_clip(results[0])
pytest tests/
We follow PEP 8 guidelines. Run linting:
flake8 sainma/
Key configuration options in .env
:
MOVIE_DATA_DIR
: Directory containing movie filesCACHE_DIR
: Directory for caching resultsMAX_CLIP_LENGTH
: Maximum clip duration in secondsSEARCH_THRESHOLD
: Minimum similarity score for search resultsGPU_MEMORY_LIMIT
: Maximum GPU memory usage (0.0-1.0)
See .env.example
for all configuration options.
Core dependencies:
- CrewAI: Agent coordination
- PyTorch: ML operations
- OpenCV: Video processing
- FAISS: Similarity search
- Sentence Transformers: Text embeddings
See requirements.txt
for complete list.
MIT License. See LICENSE file for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
See DEVELOPMENT_ROADMAP.md
for detailed development plans.