martinjosifoski commited on
Commit
7680f06
·
1 Parent(s): c3862ba

First commit.

Browse files
Files changed (5) hide show
  1. .gitignore +73 -0
  2. README.md +25 -3
  3. __init__.py +9 -0
  4. pip_requirements.py +0 -0
  5. run.py +63 -0
.gitignore ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Linux ###
2
+ *~
3
+
4
+ # temporary files which can be created if a process still has a handle open of a deleted file
5
+ .fuse_hidden*
6
+
7
+ # KDE directory preferences
8
+ .directory
9
+
10
+ # Linux trash folder which might appear on any partition or disk
11
+ .Trash-*
12
+
13
+ # .nfs files are created when an open file is removed but is still being accessed
14
+ .nfs*
15
+
16
+ ### macOS ###
17
+ # General
18
+ .DS_Store
19
+ .AppleDouble
20
+ .LSOverride
21
+
22
+ # Icon must end with two \r
23
+ Icon
24
+
25
+
26
+ # Thumbnails
27
+ ._*
28
+
29
+ # Files that might appear in the root of a volume
30
+ .DocumentRevisions-V100
31
+ .fseventsd
32
+ .Spotlight-V100
33
+ .TemporaryItems
34
+ .Trashes
35
+ .VolumeIcon.icns
36
+ .com.apple.timemachine.donotpresent
37
+
38
+ # Directories potentially created on remote AFP share
39
+ .AppleDB
40
+ .AppleDesktop
41
+ Network Trash Folder
42
+ Temporary Items
43
+ .apdisk
44
+
45
+ ### macOS Patch ###
46
+ # iCloud generated files
47
+ *.icloud
48
+
49
+ ### Windows ###
50
+ # Windows thumbnail cache files
51
+ Thumbs.db
52
+ Thumbs.db:encryptable
53
+ ehthumbs.db
54
+ ehthumbs_vista.db
55
+
56
+ # Dump file
57
+ *.stackdump
58
+
59
+ # Folder config file
60
+ [Dd]esktop.ini
61
+
62
+ # Recycle Bin used on file shares
63
+ $RECYCLE.BIN/
64
+
65
+ # Windows Installer files
66
+ *.cab
67
+ *.msi
68
+ *.msix
69
+ *.msm
70
+ *.msp
71
+
72
+ # Windows shortcuts
73
+ *.lnk
README.md CHANGED
@@ -1,3 +1,25 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Description
2
+
3
+ < Flow description >
4
+
5
+ ## Configuration parameters
6
+
7
+ < Name 1 > (< Type 1 >): < Description 1 >. Required parameter.
8
+
9
+ < Name 2 > (< Type 2 >): < Description 2 >. Default value is: < value 2 >
10
+
11
+ ## Input interface
12
+
13
+ < Name 1 > (< Type 1 >): < Description 1 >.
14
+
15
+ (Note that the interface might depend on the state of the Flow.)
16
+
17
+ ## Output interface
18
+
19
+ < Name 1 > (< Type 1 >): < Description 1 >.
20
+
21
+ (Note that the interface might depend on the state of the Flow.)
22
+
23
+ ### Licence
24
+
25
+ MIT
__init__.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # ~~~ Specify the dependencies ~~~
2
+ # e.g.,
3
+ # dependencies = [
4
+ # {"url": "aiflows/AutoGPTFlowModule", "revision": "main"},
5
+ # ]
6
+ # Revision can correspond toa branch, commit hash or a absolute path to a local directory (ideal for development)
7
+ # from flows import flow_verse
8
+
9
+ # flow_verse.sync_dependencies(dependencies)
pip_requirements.py ADDED
File without changes
run.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A simple script to run a Flow that can be used for development and debugging."""
2
+
3
+ import os
4
+
5
+ import hydra
6
+
7
+ import flows
8
+ from flows.flow_launchers import FlowLauncher, ApiInfo
9
+ from flows.utils.general_helpers import read_yaml_file
10
+
11
+ from flows import logging
12
+ from flows.flow_cache import CACHING_PARAMETERS, clear_cache
13
+
14
+ CACHING_PARAMETERS.do_caching = False # Set to True to enable caching
15
+ # clear_cache() # Uncomment this line to clear the cache
16
+
17
+ logging.set_verbosity_debug()
18
+
19
+
20
+ if __name__ == "__main__":
21
+ # ~~~ Set the API information ~~~
22
+ # OpenAI backend
23
+ # api_information = ApiInfo("openai", os.getenv("OPENAI_API_KEY"))
24
+ # Azure backend
25
+ api_information = ApiInfo("azure", os.getenv("AZURE_OPENAI_KEY"), os.getenv("AZURE_OPENAI_ENDPOINT"))
26
+
27
+ # ~~~ Instantiate the Flow ~~~
28
+ root_dir = "."
29
+ cfg_path = os.path.join(root_dir, "FlowName.yaml")
30
+ cfg = read_yaml_file(cfg_path)
31
+
32
+ flow_with_interfaces = {
33
+ "flow": hydra.utils.instantiate(cfg['flow'], _recursive_=False, _convert_="partial"),
34
+ "input_interface": (
35
+ None
36
+ if getattr(cfg, "input_interface", None) is None
37
+ else hydra.utils.instantiate(cfg['input_interface'], _recursive_=False)
38
+ ),
39
+ "output_interface": (
40
+ None
41
+ if getattr(cfg, "output_interface", None) is None
42
+ else hydra.utils.instantiate(cfg['output_interface'], _recursive_=False)
43
+ ),
44
+ }
45
+
46
+ # ~~~ Get the data ~~~
47
+ # This can be a list of samples
48
+ data = {"id": 0} # Add your data here
49
+
50
+ # ~~~ Run inference ~~~
51
+ path_to_output_file = None
52
+ # path_to_output_file = "output.jsonl" # Uncomment this line to save the output to disk
53
+
54
+ _, outputs = FlowLauncher.launch(
55
+ flow_with_interfaces=flow_with_interfaces,
56
+ data=data,
57
+ path_to_output_file=path_to_output_file,
58
+ api_information=api_information,
59
+ )
60
+
61
+ # ~~~ Print the output ~~~
62
+ flow_output_data = outputs[0]
63
+ print(flow_output_data)