Download RunCodeFlow.py from aiflows/RunCodeFlowModule: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/aiflows/RunCodeFlowModule/resolve/main/RunCodeFlow.py
- Command line
-
hf download hf://aiflows/RunCodeFlowModule/RunCodeFlow.py
-
curl -L -o RunCodeFlow.py https://huggingface.co/aiflows/RunCodeFlowModule/resolve/main/RunCodeFlow.py
1.41 kB
| from aiflows.base_flows import SequentialFlow | |
| from aiflows.utils import logging | |
| logging.set_verbosity_debug() | |
| log = logging.get_logger(__name__) | |
| class RunCodeFlow(SequentialFlow): | |
| """This flow is used to run code in a file. It opens up the file in VSCode and waits for the user to save and close the file. | |
| Once the file is saved and closed, it reads the code from the file and executes it. It then returns the output of the execution. | |
| Finally, the flow asks the user for feedback on the execution of the code. | |
| *Input Interface*: | |
| - code: The code to be executed. | |
| - language: The language of the code to be executed. | |
| - memory_files: The dictionary containing the location of the code library. | |
| *Output Interface*: | |
| - summary: The summary of the execution of the code. (To be written to the logs of the caller flow) | |
| - result: The result of the execution of the code. (To be returned to the controller of the caller flow) | |
| *Configuration Parameters*: | |
| - `input_interface`: The input interface of the flow. (Default: `['code', 'language', 'memory_files']`) | |
| - `output_interface`: The output interface of the flow. (Default: `['summary', 'result']`) | |
| - `subflows_config`: The configuration of the subflows of the flow. | |
| - `early_exit_key`: The key to be pressed to exit the flow early. | |
| - `topology`: The topology of the subflows. | |
| """ | |
| pass |