Download sort_lines/utils.py from aggr8/Percept-V: direct link, hf CLI and curl.
- Browser
- Download file 513 Bytes
-
https://huggingface.co/datasets/aggr8/Percept-V/resolve/main/sort_lines/utils.py
- Command line
-
hf download hf://datasets/aggr8/Percept-V/sort_lines/utils.py
-
curl -L -o utils.py https://huggingface.co/datasets/aggr8/Percept-V/resolve/main/sort_lines/utils.py
513 Bytes
| def output_from_text(text): | |
| """ | |
| Parse the text to extract the number of objects and the path. | |
| Splits the text by commas and removes leading and trailing whitespace from each element. | |
| """ | |
| try: | |
| lines = text.strip().split("\n") | |
| path = [int(item.strip()) for item in lines[-1].split(" ")] | |
| return { | |
| "OUTPUT": path, | |
| "ERROR": None | |
| } | |
| except Exception as e: | |
| return { | |
| "OUTPUT": None, | |
| "ERROR": str(e) | |
| } | |