2023-05-07 17:27:54 +08:00
|
|
|
from enum import Enum, auto
|
|
|
|
|
2023-05-17 11:39:00 +08:00
|
|
|
Model = "model"
|
|
|
|
Model_Status = "model_status"
|
|
|
|
Model_Config = "model_config"
|
2023-05-07 17:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ModelStatus(Enum):
|
|
|
|
Offline = auto()
|
|
|
|
Loading = auto()
|
|
|
|
Working = auto()
|
|
|
|
|
|
|
|
|
|
|
|
def init():
|
|
|
|
global GLOBALS
|
|
|
|
GLOBALS = {}
|
|
|
|
set(Model_Status, ModelStatus.Offline)
|
|
|
|
|
|
|
|
|
|
|
|
def set(key, value):
|
|
|
|
GLOBALS[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
def get(key):
|
|
|
|
if key in GLOBALS:
|
|
|
|
return GLOBALS[key]
|
|
|
|
else:
|
|
|
|
return None
|