mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 14:47:40 +03:00
Cleanup audio mypy
This commit is contained in:
parent
f5034f7c58
commit
178d30606d
@ -53,7 +53,7 @@ class AudioTranscriptionModelRunner:
|
|||||||
self.downloader = ModelDownloader(
|
self.downloader = ModelDownloader(
|
||||||
model_name="sherpa-onnx",
|
model_name="sherpa-onnx",
|
||||||
download_path=download_path,
|
download_path=download_path,
|
||||||
file_names=self.model_files.keys(),
|
file_names=list(self.model_files.keys()),
|
||||||
download_func=self.__download_models,
|
download_func=self.__download_models,
|
||||||
)
|
)
|
||||||
self.downloader.ensure_model_files()
|
self.downloader.ensure_model_files()
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
from typing import Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ class AudioTranscriptionRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
self.config = config
|
self.config = config
|
||||||
self.camera_config = camera_config
|
self.camera_config = camera_config
|
||||||
self.requestor = requestor
|
self.requestor = requestor
|
||||||
self.stream = None
|
self.stream: Any = None
|
||||||
self.whisper_model = None
|
self.whisper_model: FasterWhisperASR | None = None
|
||||||
self.model_runner = model_runner
|
self.model_runner = model_runner
|
||||||
self.transcription_segments = []
|
self.transcription_segments: list[str] = []
|
||||||
self.audio_queue = queue.Queue()
|
self.audio_queue: queue.Queue[tuple[dict[str, Any], np.ndarray]] = queue.Queue()
|
||||||
self.stop_event = stop_event
|
self.stop_event = stop_event
|
||||||
|
|
||||||
def __build_recognizer(self) -> None:
|
def __build_recognizer(self) -> None:
|
||||||
@ -142,10 +142,10 @@ class AudioTranscriptionRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
logger.error(f"Error processing audio stream: {e}")
|
logger.error(f"Error processing audio stream: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def process_frame(self, obj_data: dict[str, any], frame: np.ndarray) -> None:
|
def process_frame(self, obj_data: dict[str, Any], frame: np.ndarray) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def process_audio(self, obj_data: dict[str, any], audio: np.ndarray) -> bool | None:
|
def process_audio(self, obj_data: dict[str, Any], audio: np.ndarray) -> bool | None:
|
||||||
if audio is None or audio.size == 0:
|
if audio is None or audio.size == 0:
|
||||||
logger.debug("No audio data provided for transcription")
|
logger.debug("No audio data provided for transcription")
|
||||||
return None
|
return None
|
||||||
@ -269,13 +269,13 @@ class AudioTranscriptionRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle_request(
|
def handle_request(
|
||||||
self, topic: str, request_data: dict[str, any]
|
self, topic: str, request_data: dict[str, Any]
|
||||||
) -> dict[str, any] | None:
|
) -> dict[str, Any] | None:
|
||||||
if topic == "clear_audio_recognizer":
|
if topic == "clear_audio_recognizer":
|
||||||
self.stream = None
|
self.stream = None
|
||||||
self.__build_recognizer()
|
self.__build_recognizer()
|
||||||
return {"message": "Audio recognizer cleared and rebuilt", "success": True}
|
return {"message": "Audio recognizer cleared and rebuilt", "success": True}
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def expire_object(self, object_id: str) -> None:
|
def expire_object(self, object_id: str, camera: str) -> None:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user