- 以 ConsumableVisionAlgorithmService 替代 consumable_classifier 与 tear_action; 可选手部检测权重,未配置时全帧分类;时间窗众数与 Excel 白名单配置。 - 语音待确认:ASR 先匹配 pending topk,再匹配本台 candidate_consumables; 记账 item_id 与 vision 一致使用 name_to_code。 - 更新 config、Compose、.env.example、依赖(pandas/openpyxl)与测试。 Made-with: Cursor
67 lines
2.3 KiB
Python
67 lines
2.3 KiB
Python
from loguru import logger
|
|
|
|
from app.config import settings
|
|
from app.repositories.surgery_results import SurgeryResultRepository
|
|
from app.repositories.voice_audits import VoiceAuditRepository
|
|
from app.services.baidu_speech import BaiduSpeechService
|
|
from app.services.consumable_vision_algorithm import ConsumableVisionAlgorithmService
|
|
from app.services.minio_audio_storage import MinioAudioStorageService
|
|
from app.services.surgery_pipeline import SurgeryPipeline
|
|
from app.services.voice_resolution import VoiceConfirmationService
|
|
from app.services.video.hikvision_runtime import HikvisionRuntime
|
|
from app.services.video.session_manager import CameraSessionManager
|
|
|
|
consumable_vision_algorithm_service = ConsumableVisionAlgorithmService()
|
|
|
|
hikvision_runtime = HikvisionRuntime.try_load(settings.hikvision_lib_dir)
|
|
if settings.hikvision_sdk_enabled and hikvision_runtime is None:
|
|
logger.warning(
|
|
"HIKVISION_SDK_ENABLED=true but no HCNetSDK library loaded "
|
|
"(check HIKVISION_LIB_DIR / mount /opt/hikvision/lib)"
|
|
)
|
|
|
|
surgery_result_repository = SurgeryResultRepository()
|
|
voice_audit_repository = VoiceAuditRepository()
|
|
baidu_speech_service = BaiduSpeechService()
|
|
minio_audio_storage_service = MinioAudioStorageService(settings)
|
|
|
|
camera_session_manager = CameraSessionManager(
|
|
settings=settings,
|
|
vision_algorithm=consumable_vision_algorithm_service,
|
|
hikvision_runtime=hikvision_runtime,
|
|
result_repository=surgery_result_repository,
|
|
)
|
|
voice_confirmation_service = VoiceConfirmationService(
|
|
settings=settings,
|
|
sessions=camera_session_manager,
|
|
baidu=baidu_speech_service,
|
|
minio=minio_audio_storage_service,
|
|
audits=voice_audit_repository,
|
|
)
|
|
|
|
surgery_pipeline = SurgeryPipeline(
|
|
camera_session_manager,
|
|
result_repository=surgery_result_repository,
|
|
voice_confirmation=voice_confirmation_service,
|
|
)
|
|
|
|
|
|
def get_consumable_vision_algorithm_service() -> ConsumableVisionAlgorithmService:
|
|
return consumable_vision_algorithm_service
|
|
|
|
|
|
def get_surgery_pipeline() -> SurgeryPipeline:
|
|
return surgery_pipeline
|
|
|
|
|
|
def get_camera_session_manager() -> CameraSessionManager:
|
|
return camera_session_manager
|
|
|
|
|
|
def get_surgery_result_repository() -> SurgeryResultRepository:
|
|
return surgery_result_repository
|
|
|
|
|
|
def get_voice_confirmation_service() -> VoiceConfirmationService:
|
|
return voice_confirmation_service
|