| | from smolagents import DuckDuckGoSearchTool |
| | import random |
| | from huggingface_hub import list_models |
| |
|
| | def get_hub_stats(author: str) -> str: |
| | """Fetches the most downloaded model from a specific author on the Hugging Face Hub.""" |
| | try: |
| | |
| | models = list(list_models(author=author, sort="downloads", direction=-1, limit=1)) |
| |
|
| | if models: |
| | model = models[0] |
| | return f"The most downloaded model by {author} is {model.id} with {model.downloads:,} downloads." |
| | else: |
| | return f"No models found for author {author}." |
| | except Exception as e: |
| | return f"Error fetching models for {author}: {str(e)}" |