Download run.py from aiflows/PlanFileEditFlowModule: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/aiflows/PlanFileEditFlowModule/resolve/main/run.py
- Command line
-
hf download hf://aiflows/PlanFileEditFlowModule/run.py
-
curl -L -o run.py https://huggingface.co/aiflows/PlanFileEditFlowModule/resolve/main/run.py
1.48 kB
| import os | |
| import hydra | |
| from aiflows.messages import InputMessage | |
| from aiflows.utils.general_helpers import read_yaml_file | |
| from aiflows import logging | |
| from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache | |
| CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching | |
| # clear_cache() # Uncomment this line to clear the cache | |
| logging.set_verbosity_debug() | |
| logging.auto_set_dir() | |
| dependencies = [ | |
| {"url": "aiflows/PlanFileEditFlowModule", "revision": "main"}, | |
| ] | |
| from aiflows import flow_verse | |
| flow_verse.sync_dependencies(dependencies) | |
| if __name__ == "__main__": | |
| current_dir = os.getcwd() | |
| cfg_path = os.path.join(current_dir, "PlanFileEditAtomicFlow.yaml") | |
| cfg = read_yaml_file(cfg_path) | |
| with open(os.path.join(current_dir, "plan.txt"), "w") as file: | |
| pass | |
| # ~~~ instantiating the flow and input data ~~~ | |
| PlanFileEditFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial") | |
| plan = """ | |
| 1. Go to Italy. | |
| 2. Order pineapple pizza. | |
| """ | |
| input_data = { | |
| "plan": plan, | |
| "plan_file_location": os.path.join(current_dir, "plan.txt") | |
| } | |
| input_message = InputMessage.build( | |
| data_dict=input_data, | |
| src_flow="Launcher", | |
| dst_flow=PlanFileEditFlow.name | |
| ) | |
| # ~~~ calling the flow ~~~ | |
| output_message = PlanFileEditFlow(input_message) | |
| # By now, the plan should have been written to the temp_plan.txt file. | |
| print(output_message.data) |