forked from Github/frigate
Disable semantic search by default (#12568)
* Disable semantic search by default and don't start processes unless enabled * Conditionally create embeddings * Fix typing
This commit is contained in:
@@ -7,6 +7,7 @@ import os
|
||||
import traceback
|
||||
from datetime import datetime, timedelta
|
||||
from functools import reduce
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
from flask import Blueprint, Flask, current_app, jsonify, make_response, request
|
||||
@@ -55,7 +56,7 @@ bp.register_blueprint(NotificationBp)
|
||||
def create_app(
|
||||
frigate_config,
|
||||
database: SqliteQueueDatabase,
|
||||
embeddings: EmbeddingsContext,
|
||||
embeddings: Optional[EmbeddingsContext],
|
||||
detected_frames_processor,
|
||||
storage_maintainer: StorageMaintainer,
|
||||
onvif: OnvifController,
|
||||
|
||||
@@ -321,6 +321,10 @@ class FrigateApp:
|
||||
logger.info(f"Review process started: {review_segment_process.pid}")
|
||||
|
||||
def init_embeddings_manager(self) -> None:
|
||||
if not self.config.semantic_search.enabled:
|
||||
self.embeddings = None
|
||||
return
|
||||
|
||||
# Create a client for other processes to use
|
||||
self.embeddings = EmbeddingsContext()
|
||||
embedding_process = mp.Process(
|
||||
@@ -816,7 +820,8 @@ class FrigateApp:
|
||||
self.db.stop()
|
||||
|
||||
# Save embeddings stats to disk
|
||||
self.embeddings.save_stats()
|
||||
if self.embeddings:
|
||||
self.embeddings.save_stats()
|
||||
|
||||
# Stop Communicators
|
||||
self.inter_process_communicator.stop()
|
||||
|
||||
@@ -736,7 +736,7 @@ class ReviewConfig(FrigateBaseModel):
|
||||
|
||||
|
||||
class SemanticSearchConfig(FrigateBaseModel):
|
||||
enabled: bool = Field(default=True, title="Enable semantic search.")
|
||||
enabled: bool = Field(default=False, title="Enable semantic search.")
|
||||
reindex: Optional[bool] = Field(
|
||||
default=False, title="Reindex all detections on startup."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user