File size: 2,305 Bytes
947c505 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """
Video Intelligence Platform β Configuration
"""
import os
from dataclasses import dataclass, field
from typing import Optional
@dataclass
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'"
)
|