mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-22 08:08:22 +03:00
fix audio transcription embedding
This commit is contained in:
parent
8ddf3ac72e
commit
d4af7f0966
@ -9,7 +9,6 @@ from typing import Optional
|
|||||||
from faster_whisper import WhisperModel
|
from faster_whisper import WhisperModel
|
||||||
from peewee import DoesNotExist
|
from peewee import DoesNotExist
|
||||||
|
|
||||||
from frigate.comms.embeddings_updater import EmbeddingsRequestEnum
|
|
||||||
from frigate.comms.inter_process import InterProcessRequestor
|
from frigate.comms.inter_process import InterProcessRequestor
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
@ -32,11 +31,13 @@ class AudioTranscriptionPostProcessor(PostProcessorApi):
|
|||||||
self,
|
self,
|
||||||
config: FrigateConfig,
|
config: FrigateConfig,
|
||||||
requestor: InterProcessRequestor,
|
requestor: InterProcessRequestor,
|
||||||
|
embeddings,
|
||||||
metrics: DataProcessorMetrics,
|
metrics: DataProcessorMetrics,
|
||||||
):
|
):
|
||||||
super().__init__(config, metrics, None)
|
super().__init__(config, metrics, None)
|
||||||
self.config = config
|
self.config = config
|
||||||
self.requestor = requestor
|
self.requestor = requestor
|
||||||
|
self.embeddings = embeddings
|
||||||
self.recognizer = None
|
self.recognizer = None
|
||||||
self.transcription_lock = threading.Lock()
|
self.transcription_lock = threading.Lock()
|
||||||
self.transcription_thread = None
|
self.transcription_thread = None
|
||||||
@ -128,10 +129,7 @@ class AudioTranscriptionPostProcessor(PostProcessorApi):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Embed the description
|
# Embed the description
|
||||||
self.requestor.send_data(
|
self.embeddings.embed_description(event_id, transcription)
|
||||||
EmbeddingsRequestEnum.embed_description.value,
|
|
||||||
{"id": event_id, "description": transcription},
|
|
||||||
)
|
|
||||||
|
|
||||||
except DoesNotExist:
|
except DoesNotExist:
|
||||||
logger.debug("No recording found for audio transcription post-processing")
|
logger.debug("No recording found for audio transcription post-processing")
|
||||||
|
|||||||
@ -226,7 +226,9 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
for c in self.config.cameras.values()
|
for c in self.config.cameras.values()
|
||||||
):
|
):
|
||||||
self.post_processors.append(
|
self.post_processors.append(
|
||||||
AudioTranscriptionPostProcessor(self.config, self.requestor, metrics)
|
AudioTranscriptionPostProcessor(
|
||||||
|
self.config, self.requestor, self.embeddings, metrics
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
semantic_trigger_processor: SemanticTriggerProcessor | None = None
|
semantic_trigger_processor: SemanticTriggerProcessor | None = None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user