Spaces:
Running
Running
Download src/backend/tests/data/component.py from opendigital/agent-flow: direct link, hf CLI and curl.
- Browser
- Download file 519 Bytes
-
https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/tests/data/component.py
- Command line
-
hf download hf://spaces/opendigital/agent-flow/src/backend/tests/data/component.py
-
curl -L -o component.py https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/tests/data/component.py
519 Bytes
| import random | |
| from langflow.custom import CustomComponent | |
| class TestComponent(CustomComponent): | |
| def refresh_values(self): | |
| # This is a function that will be called every time the component is updated | |
| # and should return a list of random strings | |
| return [f"Random {random.randint(1, 100)}" for _ in range(5)] # noqa: S311 | |
| def build_config(self): | |
| return {"param": {"display_name": "Param", "options": self.refresh_values}} | |
| def build(self, param: int): | |
| return param | |