forked from Rakile/NeuralCompanion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared_state.py
More file actions
105 lines (63 loc) · 2.89 KB
/
shared_state.py
File metadata and controls
105 lines (63 loc) · 2.89 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from __future__ import annotations
import importlib
from core import expression_state
def _musetalk_state():
return importlib.import_module("addons.musetalk_avatar.state")
def _visual_reply_state():
return importlib.import_module("addons.visual_reply.state")
_MUSE_DYNAMIC_NAMES = {
"MUSE_PREVIEW_STATE_PATH",
"MUSE_PREVIEW_FRAME_PATH",
"MUSE_PREVIEW_LOG_PATH",
"MUSE_PREVIEW_FILE_LOG_ENABLED",
"current_musetalk_frame_data",
"current_musetalk_preview_chunk_id",
"current_musetalk_pipeline_data",
}
_VISUAL_DYNAMIC_NAMES = {
"VISUAL_REPLY_STATE_PATH",
"current_visual_reply_data",
}
_EXPRESSION_DYNAMIC_NAMES = {
"current_expression_data",
}
def __getattr__(name):
if name in _MUSE_DYNAMIC_NAMES:
return getattr(_musetalk_state(), name)
if name in _VISUAL_DYNAMIC_NAMES:
return getattr(_visual_reply_state(), name)
if name in _EXPRESSION_DYNAMIC_NAMES:
return getattr(expression_state, name)
raise AttributeError(name)
def append_musetalk_preview_log(message):
return _musetalk_state().append_musetalk_preview_log(message)
def write_musetalk_preview_snapshot(state=None):
return _musetalk_state().write_musetalk_preview_snapshot(state)
def write_musetalk_preview_frame(payload):
return _musetalk_state().write_musetalk_preview_frame(payload)
def consume_musetalk_preview_feed(after_seq=0):
return _musetalk_state().consume_musetalk_preview_feed(after_seq)
def set_current_musetalk_frame_data(state):
return _musetalk_state().set_current_musetalk_frame_data(state)
def update_current_musetalk_frame_data(**updates):
return _musetalk_state().update_current_musetalk_frame_data(**updates)
def write_visual_reply_snapshot(state=None):
return _visual_reply_state().write_visual_reply_snapshot(state)
def set_current_visual_reply_data(state):
return _visual_reply_state().set_current_visual_reply_data(state)
def update_current_visual_reply_data(**updates):
return _visual_reply_state().update_current_visual_reply_data(**updates)
def reset_musetalk_pipeline_data():
return _musetalk_state().reset_musetalk_pipeline_data()
def begin_musetalk_pipeline_reply(stream_mode=False):
return _musetalk_state().begin_musetalk_pipeline_reply(stream_mode=stream_mode)
def update_musetalk_pipeline_chunk(sequence_index, reply_id=None, **updates):
return _musetalk_state().update_musetalk_pipeline_chunk(sequence_index, reply_id=reply_id, **updates)
def update_musetalk_pipeline_flags(reply_id=None, **updates):
return _musetalk_state().update_musetalk_pipeline_flags(reply_id=reply_id, **updates)
def get_musetalk_pipeline_snapshot():
return _musetalk_state().get_musetalk_pipeline_snapshot()
def set_current_expression_data(state):
return expression_state.set_current_expression_data(state)
def reset_current_expression_data():
return expression_state.reset_current_expression_data()