Spaces:
Sleeping
Sleeping
Download formatter_node.py from Umer797/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 280 Bytes
-
https://huggingface.co/spaces/Umer797/Final_Assignment_Template/resolve/main/formatter_node.py
- Command line
-
hf download hf://spaces/Umer797/Final_Assignment_Template/formatter_node.py
-
curl -L -o formatter_node.py https://huggingface.co/spaces/Umer797/Final_Assignment_Template/resolve/main/formatter_node.py
280 Bytes
| import re | |
| def formatter_node(llm_output): | |
| cleaned = llm_output.strip() | |
| cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE) | |
| if cleaned.startswith('"') and cleaned.endswith('"'): | |
| cleaned = cleaned[1:-1] | |
| return cleaned.strip() | |