You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from smolagents import Tool
class FileTool(Tool):
name = "file_tool"
description = """
i can upload,download,delete file from hf"""
inputs = {
"task": {
"type": "string",
"description": "the task category (such as text-classification, depth-estimation, etc)",
}
}
output_type = "string"
def upload_file(self, file_path: str, repo_id: str, commit_message: str):
from huggingface_hub import upload_file
upload_file(file_path, repo_id, commit_message)
def download_file(self, repo_id: str, file_path: str):
from huggingface_hub import download_file
def delete_file(self, repo_id: str, file_path: str):
from huggingface_hub import delete_file
delete_file(repo_id, file_path)
file_tool = FileTool()
it's old:
from smolagents import Tool
class HFModelDownloadsTool(Tool):
name = "model_download_counter"
description = """
This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub.
It returns the name of the checkpoint."""
inputs = {
"task": {
"type": "string",
"description": "the task category (such as text-classification, depth-estimation, etc)",
}
}
output_type = "string"
def forward(self, task: str):
from huggingface_hub import list_models
model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
return model.id
model_downloads_tool = HFModelDownloadsTool()
what should i do
The text was updated successfully, but these errors were encountered:
For example:
it's old:
what should i do
The text was updated successfully, but these errors were encountered: