File size: 1,341 Bytes
18c46ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# config.py

"""
File: config.py
Description: Configuration file for the AI-Driven Multimodal Emotional State Analysis application.
License: MIT License
"""

import toml
from typing import Dict
from types import SimpleNamespace

def flatten_dict(prefix: str, d: Dict) -> Dict:
    """
    Recursively flattens a nested dictionary, concatenating keys with underscores.
    """
    result = {}
    for k, v in d.items():
        if isinstance(v, dict):
            result.update(flatten_dict(f"{prefix}{k}_", v))
        else:
            result[f"{prefix}{k}"] = v
    return result

# Load configuration from 'config.toml' if it exists
try:
    config = toml.load("config.toml")
except FileNotFoundError:
    config = {}
    print("Warning: 'config.toml' not found. Using default configuration.")

# Flatten the configuration dictionary
config_data_dict = flatten_dict("", config)

# Convert the dictionary to a SimpleNamespace for easy attribute access
config_data = SimpleNamespace(**config_data_dict)

# Define emotion labels
DICT_EMO = {
    0: "Neutral",
    1: "Happiness",
    2: "Sadness",
    3: "Surprise",
    4: "Fear",
    5: "Disgust",
    6: "Anger",
}

# Define colors for plotting or UI elements
COLORS = {
    0: 'blue', 
    1: 'orange', 
    2: 'green', 
    3: 'red', 
    4: 'purple', 
    5: 'brown', 
    6: 'pink'
}