Spaces:
Build error
Build error
Download gpt_computer_agent/utils/function.py from khulnasoft/gpt-computer-agent: direct link, hf CLI and curl.
- Browser
- Download file 395 Bytes
-
https://huggingface.co/spaces/khulnasoft/gpt-computer-agent/resolve/main/gpt_computer_agent/utils/function.py
- Command line
-
hf download hf://spaces/khulnasoft/gpt-computer-agent/gpt_computer_agent/utils/function.py
-
curl -L -o function.py https://huggingface.co/spaces/khulnasoft/gpt-computer-agent/resolve/main/gpt_computer_agent/utils/function.py
395 Bytes
| def string_to_function(func_str): | |
| # Define a local dictionary to execute the function string | |
| local_dict = {} | |
| # Execute the function string in the local dictionary | |
| exec(func_str, globals(), local_dict) | |
| # Extract the function name | |
| func_name = func_str.split("(")[0].split()[-1] | |
| # Return the function object from the local dictionary | |
| return local_dict[func_name] | |