ScouterAI / tools /hf_api_tool.py
stevenbucaille's picture
Add initial project structure with core functionality for image processing agents
7e327f2
raw
history blame
629 Bytes
from smolagents import Tool
from huggingface_hub import HfApi
class HFAPITool(Tool):
name = "hf_api"
description = "Use the HuggingFace API to search for models"
inputs = {
"prompt": {
"type": "string",
"description": "The prompt to search for models",
},
}
output_type = "object"
def __init__(self):
super().__init__()
self.api = HfApi()
def forward(self, prompt: str):
models = self.api.list_models(
library=["transformers"], pipeline_tag="object-detection", fetch_config=True
)
print(models)