| """ | |
| Video Intelligence Platform β Configuration | |
| """ | |
| import os | |
| from dataclasses import dataclass, field | |
| from typing import Optional | |
| class Config: | |
| # ββ Gemini API ββββββββββββββββββββββββββββββββββββββββββββββ | |
| gemini_api_key: str = field(default_factory=lambda: os.environ.get("GEMINI_API_KEY", "")) | |
| gemini_vision_model: str = "gemini-2.0-flash" | |
| gemini_embedding_model: str = "text-embedding-004" | |
| gemini_embedding_dim: int = 768 | |
| # ββ SigLIP2 for frame embeddings ββββββββββββββββββββββββββββ | |
| siglip_model: str = "google/siglip2-so400m-patch14-384" | |
| siglip_embedding_dim: int = 1152 | |
| # ββ Grounding DINO for attribute detection ββββββββββββββββββ | |
| grounding_dino_model: str = "IDEA-Research/grounding-dino-tiny" | |
| detection_box_threshold: float = 0.35 | |
| detection_text_threshold: float = 0.25 | |
| # ββ Frame extraction ββββββββββββββββββββββββββββββββββββββββ | |
| extract_fps: float = 1.0 # frames per second to extract | |
| max_frames: int = 3600 # cap at 1hr @ 1fps | |
| # ββ Indexing ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| db_path: str = "video_index.db" # SQLite path | |
| faiss_visual_path: str = "visual_index.faiss" | |
| faiss_caption_path: str = "caption_index.faiss" | |
| # ββ Search ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| top_k: int = 20 | |
| akinator_threshold: int = 10 # if results > this, start tree refinement | |
| # ββ Device ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| device: str = "cpu" | |
| def validate(self): | |
| if not self.gemini_api_key: | |
| raise ValueError( | |
| "GEMINI_API_KEY not set. Export it: export GEMINI_API_KEY='your-key'" | |
| ) | |