diff --git a/ai/microservices/behavior-analyzer/engine/baServices.py b/ai/microservices/behavior-analyzer/engine/baServices.py new file mode 100644 index 00000000..c06791bd --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/baServices.py @@ -0,0 +1,21 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## This module handles the behavior-analyzer microservice. +## + +import queue +import sys +import json +import sounddevice as sd +import engine.enumMcs as enumMcs + +from .notifications import Notifications + +class BA(): + def __init__(self): + """ + Class constructor + """ + pass diff --git a/ai/microservices/behavior-analyzer/engine/enumMcs.py b/ai/microservices/behavior-analyzer/engine/enumMcs.py new file mode 100644 index 00000000..6003379c --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/enumMcs.py @@ -0,0 +1,43 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## This file defines the enumerations for microservices. +## + +from enum import Enum + +class MicroservicesNames(Enum): + BA = 0 + EA = 1 + STT = 2 + TTS = 3 + VA = 4 + +class NotificationTypes(): + def __init__(self): + self.types = { + 0: { + "type": "INFO", + "emoji": "💡" + }, + 1: { + "type": "WARNING", + "emoji": "⚠️" + }, + 2: { + "type": "ERROR", + "emoji": "❗" + } + } + def get_type(self, type_id: int) -> str: + """ + Get the type of notification by its ID. + """ + return self.types.get(type_id, {}).get("type", "UNKNOWN") + + def get_emoji(self, type_id: int) -> str: + """ + Get the emoji for the notification type by its ID. + """ + return self.types.get(type_id, {}).get("emoji", "❓") diff --git a/ai/microservices/behavior-analyzer/engine/notifications.py b/ai/microservices/behavior-analyzer/engine/notifications.py new file mode 100644 index 00000000..fac964b2 --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/notifications.py @@ -0,0 +1,35 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## Handles notifications for the TalkUp AI microservices. +## + +import engine.enumMcs as enumMcs + +class Notifications(): + def __init__(self): + """ + Class constructor + """ + pass + + def send_notification(self, service: enumMcs.MicroservicesNames, type_id: int, + msg: str) -> None: + """ + Send a notification to the console + """ + type = enumMcs.NotificationTypes() + + print(f"[{type.get_type(type_id)}|{service.name}] {type.get_emoji(type_id)} {msg}", end='\n') + + def send_start_notification(self, service: enumMcs.MicroservicesNames, successful: bool)-> None: + """ + Send a start notification to the console with the status of the service. + """ + type = enumMcs.NotificationTypes() + + if (successful): + print (f"[SERVICES] {type.get_emoji(0)} {service.name} started successfully!") + else: + print (f"[SERVICES] {type.get_emoji(2)} Failed to start {service.name}") diff --git a/ai/microservices/behavior-analyzer/requirements.txt b/ai/microservices/behavior-analyzer/requirements.txt index b90088ba..670d22c5 100644 --- a/ai/microservices/behavior-analyzer/requirements.txt +++ b/ai/microservices/behavior-analyzer/requirements.txt @@ -1,9 +1,15 @@ -blinker==1.9.0 -click==8.2.1 Flask==3.1.1 itsdangerous==2.2.0 -Jinja2==3.1.6 -MarkupSafe==3.0.2 -Werkzeug==3.1.3 pydantic==2.5.1 fastapi==0.101.1 +numpy==1.24.4 +torch==2.1.2 +torchvision==0.16.2 +torchaudio==2.1.2 +opencv-python>=4.8.0 +openmim +mmengine>=0.10.0 +mmcv==2.1.0 +mmdet==3.3.0 +mmpose==1.3.2 +transformers==4.40.1