Spaces:
Runtime error
Runtime error
Arno' Francesco (GDS DS&G) commited on
Commit ·
8c280f1
1
Parent(s): 4c9f16c
add new tools
Browse files- .gitignore +59 -0
- tools.py +25 -0
.gitignore
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ignore node_modules/ for Node.js projects
|
| 2 |
+
node_modules/
|
| 3 |
+
|
| 4 |
+
# Ignore Python cache files
|
| 5 |
+
__pycache__/
|
| 6 |
+
*.py[cod]
|
| 7 |
+
*.pyo
|
| 8 |
+
|
| 9 |
+
# Ignore virtual environments
|
| 10 |
+
venv/
|
| 11 |
+
.env/
|
| 12 |
+
|
| 13 |
+
# Ignore macOS system files
|
| 14 |
+
.DS_Store
|
| 15 |
+
|
| 16 |
+
# Ignore logs and temporary files
|
| 17 |
+
*.log
|
| 18 |
+
*.tmp
|
| 19 |
+
*.swp
|
| 20 |
+
|
| 21 |
+
# Ignore IDE-specific files
|
| 22 |
+
.vscode/
|
| 23 |
+
.idea/
|
| 24 |
+
|
| 25 |
+
# Ignore build and dependency directories
|
| 26 |
+
dist/
|
| 27 |
+
build/
|
| 28 |
+
*.egg-info/
|
| 29 |
+
|
| 30 |
+
# Ignore environment files
|
| 31 |
+
.env
|
| 32 |
+
.env.local
|
| 33 |
+
|
| 34 |
+
# Ignore compiled files
|
| 35 |
+
*.class
|
| 36 |
+
*.o
|
| 37 |
+
*.so
|
| 38 |
+
|
| 39 |
+
# Ignore coverage reports
|
| 40 |
+
coverage/
|
| 41 |
+
*.cover
|
| 42 |
+
*.coverage
|
| 43 |
+
.nyc_output/
|
| 44 |
+
|
| 45 |
+
# Ignore database files
|
| 46 |
+
*.sqlite3
|
| 47 |
+
*.db
|
| 48 |
+
|
| 49 |
+
# Ignore test output
|
| 50 |
+
test-results/
|
| 51 |
+
junit-report.xml
|
| 52 |
+
|
| 53 |
+
# Ignore custom files
|
| 54 |
+
*.bak
|
| 55 |
+
*.orig
|
| 56 |
+
*.rej
|
| 57 |
+
|
| 58 |
+
# Ignore Git-specific files
|
| 59 |
+
*.lock
|
tools.py
CHANGED
|
@@ -54,3 +54,28 @@ class HubStatsTool(Tool):
|
|
| 54 |
except Exception as e:
|
| 55 |
return f"Error fetching models for {author}: {str(e)}"
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
except Exception as e:
|
| 55 |
return f"Error fetching models for {author}: {str(e)}"
|
| 56 |
|
| 57 |
+
|
| 58 |
+
class LatestNewsTool(Tool):
|
| 59 |
+
name = "latest_news"
|
| 60 |
+
description = "Fetches the latest news for a specific topic."
|
| 61 |
+
inputs = {
|
| 62 |
+
"topic": {
|
| 63 |
+
"type": "string",
|
| 64 |
+
"description": "The topic to find news for."
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
output_type = "string"
|
| 68 |
+
|
| 69 |
+
def forward(self, topic: str):
|
| 70 |
+
try:
|
| 71 |
+
# List models from the specified author, sorted by downloads
|
| 72 |
+
#models = list(list_models(author=author, sort="downloads", direction=-1, limit=1))
|
| 73 |
+
results = DuckDuckGoSearchTool(f"latest news about {topic}")
|
| 74 |
+
|
| 75 |
+
if results:
|
| 76 |
+
return f"These are the latest news about '{topic}': {results}"
|
| 77 |
+
else:
|
| 78 |
+
return f"No news found for topic '{topic}'."
|
| 79 |
+
except Exception as e:
|
| 80 |
+
return f"Error fetching news for topic '{topic}': {str(e)}"
|
| 81 |
+
|