Spaces:
Runtime error
Runtime error
Download src/gaia_solving_agent/utils.py from lwant/Agent_Course_Final_Assignment: direct link, hf CLI and curl.
- Browser
- Download file 492 Bytes
-
https://huggingface.co/spaces/lwant/Agent_Course_Final_Assignment/resolve/main/src/gaia_solving_agent/utils.py
- Command line
-
hf download hf://spaces/lwant/Agent_Course_Final_Assignment/src/gaia_solving_agent/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/lwant/Agent_Course_Final_Assignment/resolve/main/src/gaia_solving_agent/utils.py
492 Bytes
| import csv | |
| import re | |
| def extract_pattern(pattern: str, text: str) -> str | None: | |
| matches = re.findall(pattern, text) | |
| if matches: | |
| extracted = matches[-1] | |
| return extracted | |
| else: | |
| return None | |
| def read_csv_to_dicts(file_path) -> list[dict]: | |
| with open(file_path, mode='r', newline='', encoding='utf-8') as csvfile: | |
| csv_reader = csv.DictReader(csvfile) | |
| rows = [] | |
| for row in csv_reader: | |
| rows.append(row) | |
| return rows | |