Update run.py
Browse files
run.py
CHANGED
|
@@ -18,27 +18,24 @@ logging.set_verbosity_debug()
|
|
| 18 |
|
| 19 |
|
| 20 |
if __name__ == "__main__":
|
| 21 |
-
|
| 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, "
|
| 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
|
| 37 |
else hydra.utils.instantiate(cfg['input_interface'], _recursive_=False)
|
| 38 |
),
|
| 39 |
"output_interface": (
|
| 40 |
None
|
| 41 |
-
if
|
| 42 |
else hydra.utils.instantiate(cfg['output_interface'], _recursive_=False)
|
| 43 |
),
|
| 44 |
}
|
|
@@ -55,7 +52,6 @@ if __name__ == "__main__":
|
|
| 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 ~~~
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
if __name__ == "__main__":
|
| 21 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# ~~~ Instantiate the Flow ~~~
|
| 24 |
root_dir = "."
|
| 25 |
+
cfg_path = os.path.join(root_dir, "demo.yaml")
|
| 26 |
cfg = read_yaml_file(cfg_path)
|
| 27 |
|
| 28 |
+
# ~~~ Instantiate the Flow ~~~
|
| 29 |
flow_with_interfaces = {
|
| 30 |
"flow": hydra.utils.instantiate(cfg['flow'], _recursive_=False, _convert_="partial"),
|
| 31 |
"input_interface": (
|
| 32 |
None
|
| 33 |
+
if cfg.get( "input_interface", None) is None
|
| 34 |
else hydra.utils.instantiate(cfg['input_interface'], _recursive_=False)
|
| 35 |
),
|
| 36 |
"output_interface": (
|
| 37 |
None
|
| 38 |
+
if cfg.get( "output_interface", None) is None
|
| 39 |
else hydra.utils.instantiate(cfg['output_interface'], _recursive_=False)
|
| 40 |
),
|
| 41 |
}
|
|
|
|
| 52 |
flow_with_interfaces=flow_with_interfaces,
|
| 53 |
data=data,
|
| 54 |
path_to_output_file=path_to_output_file,
|
|
|
|
| 55 |
)
|
| 56 |
|
| 57 |
# ~~~ Print the output ~~~
|