vrfefavr commited on
Commit
56ca280
·
verified ·
1 Parent(s): 2c0da97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -26,13 +26,27 @@ from deepface import DeepFace
26
 
27
  # Custom Modules
28
  from core.config import LOG_FILE, MODELS
29
- from core.state import attendance_memory
30
  from api.websocket import websocket_endpoint
31
 
32
  @asynccontextmanager
33
  async def lifespan(app: FastAPI):
34
  # --- STARTUP PHASE ---
35
- # Load historical logs into RAM
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  if os.path.exists(LOG_FILE):
37
  try:
38
  df = pd.read_csv(LOG_FILE)
 
26
 
27
  # Custom Modules
28
  from core.config import LOG_FILE, MODELS
29
+ from core.state import attendance_memory, KNOWN_VECTORS
30
  from api.websocket import websocket_endpoint
31
 
32
  @asynccontextmanager
33
  async def lifespan(app: FastAPI):
34
  # --- STARTUP PHASE ---
35
+
36
+ # 1. Load the Hard Pickle (Mathematical Brain)
37
+ pickle_path = "core/embeddings.pickle"
38
+ if os.path.exists(pickle_path):
39
+ try:
40
+ with open(pickle_path, "rb") as f:
41
+ data = pickle.load(f)
42
+ KNOWN_VECTORS.update(data)
43
+ print(f"🧠 Mathematical Brain Loaded: Found {len(KNOWN_VECTORS)} identities.")
44
+ except Exception as e:
45
+ print(f"⚠️ Pickle Load Error: {e}")
46
+ else:
47
+ print("⚠️ WARNING: core/embeddings.pickle not found. Run register_faces.py first!")
48
+
49
+ # 2. Load historical logs into RAM
50
  if os.path.exists(LOG_FILE):
51
  try:
52
  df = pd.read_csv(LOG_FILE)