Tachi67 commited on
Commit
3fb58a0
·
1 Parent(s): cf3d6aa

Upload run_memwrite.py

Browse files
Files changed (1) hide show
  1. run_memwrite.py +49 -0
run_memwrite.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import hydra
4
+
5
+ from flows.backends.api_info import ApiInfo
6
+ from flows.messages import InputMessage
7
+ from flows.utils.general_helpers import read_yaml_file
8
+
9
+ from flows import logging
10
+ from flows.flow_cache import CACHING_PARAMETERS, clear_cache
11
+
12
+ CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
13
+
14
+ logging.set_verbosity_debug()
15
+ logging.auto_set_dir()
16
+
17
+ dependencies = [
18
+ {"url": "Tachi67/MemoryWritingFlowModule", "revision": "main"},
19
+ ]
20
+
21
+ from flows import flow_verse
22
+
23
+ flow_verse.sync_dependencies(dependencies)
24
+
25
+ if __name__ == "__main__":
26
+ current_dir = os.getcwd()
27
+ cfg_path = os.path.join(current_dir, "MemoryWritingAtomicFlow.yaml")
28
+ cfg = read_yaml_file(cfg_path)
29
+
30
+ MemWriteFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")
31
+
32
+ logs_file_location = os.path.join(current_dir, "logs.txt")
33
+ with open(logs_file_location, 'w') as file:
34
+ pass
35
+
36
+ input_data = {
37
+ "summary": "mama~~~~~~~~ just killed a man",
38
+ "memory_files": {
39
+ "logs": logs_file_location
40
+ }
41
+ }
42
+ input_message = InputMessage.build(
43
+ data_dict=input_data,
44
+ src_flow="Launcher",
45
+ dst_flow=MemWriteFlow.name
46
+ )
47
+
48
+ # ~~~ calling the flow ~~~
49
+ output_message = MemWriteFlow(input_message)