Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ai/microservices/behavior-analyzer/engine/baServices.py
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions ai/microservices/behavior-analyzer/engine/enumMcs.py
Original file line number Diff line number Diff line change
@@ -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", "❓")
35 changes: 35 additions & 0 deletions ai/microservices/behavior-analyzer/engine/notifications.py
Original file line number Diff line number Diff line change
@@ -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}")
16 changes: 11 additions & 5 deletions ai/microservices/behavior-analyzer/requirements.txt
Original file line number Diff line number Diff line change
@@ -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