Spaces:
Sleeping
Sleeping
Fixed the issue with self and HfApi
Browse files
tools.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from smolagents import Tool
|
| 2 |
import random
|
| 3 |
-
from huggingface_hub import
|
| 4 |
|
| 5 |
class WeatherInfoTool(Tool):
|
| 6 |
name = "weather_info"
|
|
@@ -38,7 +38,7 @@ class HubStatsTool(Tool):
|
|
| 38 |
def forward(self, author: str):
|
| 39 |
try:
|
| 40 |
# List models from the specified author, sorted by downloads
|
| 41 |
-
models = list(
|
| 42 |
|
| 43 |
if models:
|
| 44 |
model = models[-1]
|
|
|
|
| 1 |
from smolagents import Tool
|
| 2 |
import random
|
| 3 |
+
from huggingface_hub import list_models
|
| 4 |
|
| 5 |
class WeatherInfoTool(Tool):
|
| 6 |
name = "weather_info"
|
|
|
|
| 38 |
def forward(self, author: str):
|
| 39 |
try:
|
| 40 |
# List models from the specified author, sorted by downloads
|
| 41 |
+
models = list(list_models(author=author, sort="downloads"))
|
| 42 |
|
| 43 |
if models:
|
| 44 |
model = models[-1]
|