Create fetch_file_url.py
Browse files123456789101112131415161718from typing import Any, Optionalfrom smolagents.tools import Toolfrom gradio_client import Client
class FetchFileURLTool(Tool): name = "fetch_file_url" description = "Get the correct URL at which a task's file is located for download." inputs = {'lookup_link': {'type': 'any', 'description': 'The link at which to get the URL of the file. It has the pattern https://agents-course-unit4-scoring.hf.space/files/{{ task_id }}'}} output_type = "any"
def forward(self, lookup_link: Any) -> Any: print('*$%: Performing fetching of file URL at '+lookup_link) requests.get(lookup_link)
return result['markdown_content']
def __init__(self, *args, **kwargs): self.is_initialized = Falsetools/fetch_file_url.pyAdded+18