Download tools/page_navigation_tools.py from STARX33/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/spaces/STARX33/Final_Assignment_Template/resolve/main/tools/page_navigation_tools.py
- Command line
-
hf download hf://spaces/STARX33/Final_Assignment_Template/tools/page_navigation_tools.py
-
curl -L -o page_navigation_tools.py https://huggingface.co/spaces/STARX33/Final_Assignment_Template/resolve/main/tools/page_navigation_tools.py
801 Bytes
| from smolagents import tool | |
| from tools.simple_text_browser import _BROWSER | |
| def find_on_page_ctrl_f(search_string: str) -> str: | |
| """ | |
| Find the first occurrence of a string in the current page viewport. | |
| Args: | |
| search_string: The string to search for on the page. | |
| """ | |
| return _BROWSER.find_on_page(search_string) | |
| def find_next() -> str: | |
| """ | |
| Find the next occurrence of the previous search string (after find_on_page_ctrl_f). | |
| """ | |
| return _BROWSER.find_next() | |
| def page_down() -> str: | |
| """ | |
| Scroll the viewport DOWN one page-length in the current document. | |
| """ | |
| return _BROWSER.page_down() | |
| def page_up() -> str: | |
| """ | |
| Scroll the viewport UP one page-length in the current document. | |
| """ | |
| return _BROWSER.page_up() | |