2023-05-07 17:27:54 +08:00
|
|
|
from enum import Enum, auto
|
|
|
|
|
2023-08-14 22:07:15 +08:00
|
|
|
Args = "args"
|
2023-05-17 11:39:00 +08:00
|
|
|
Model = "model"
|
|
|
|
Model_Status = "model_status"
|
|
|
|
Model_Config = "model_config"
|
2023-11-08 23:29:42 +08:00
|
|
|
Deploy_Mode = "deploy_mode"
|
2024-02-03 13:04:13 +08:00
|
|
|
Midi_Vocab_Config_Type = "midi_vocab_config_type"
|
2023-05-07 17:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ModelStatus(Enum):
|
2023-05-19 15:59:04 +08:00
|
|
|
Offline = 0
|
|
|
|
Loading = 2
|
|
|
|
Working = 3
|
2023-05-07 17:27:54 +08:00
|
|
|
|
|
|
|
|
2024-02-03 13:04:13 +08:00
|
|
|
class MidiVocabConfig(Enum):
|
|
|
|
Default = auto()
|
|
|
|
Piano = auto()
|
|
|
|
|
|
|
|
|
2023-05-07 17:27:54 +08:00
|
|
|
def init():
|
|
|
|
global GLOBALS
|
|
|
|
GLOBALS = {}
|
|
|
|
set(Model_Status, ModelStatus.Offline)
|
2023-11-08 23:29:42 +08:00
|
|
|
set(Deploy_Mode, False)
|
2024-02-03 13:04:13 +08:00
|
|
|
set(Midi_Vocab_Config_Type, MidiVocabConfig.Default)
|
2023-05-07 17:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
def set(key, value):
|
|
|
|
GLOBALS[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
def get(key):
|
|
|
|
if key in GLOBALS:
|
|
|
|
return GLOBALS[key]
|
|
|
|
else:
|
|
|
|
return None
|