Spaces:
Sleeping
Sleeping
Upload tool
Browse files- app.py +5 -0
- requirements.txt +1 -0
- tool.py +22 -0
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import launch_gradio_demo
|
| 2 |
+
from tool import SimpleTool
|
| 3 |
+
|
| 4 |
+
tool = SimpleTool()
|
| 5 |
+
launch_gradio_demo(tool)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
smolagents
|
tool.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import Tool
|
| 2 |
+
from typing import Any, Optional
|
| 3 |
+
|
| 4 |
+
class SimpleTool(Tool):
|
| 5 |
+
name = "get_today_datetime"
|
| 6 |
+
description = "Get the current local date and time."
|
| 7 |
+
inputs = {}
|
| 8 |
+
output_type = "null"
|
| 9 |
+
|
| 10 |
+
def forward(self):
|
| 11 |
+
"""
|
| 12 |
+
Get the current local date and time.
|
| 13 |
+
|
| 14 |
+
Returns:
|
| 15 |
+
str: Current date and time in the format 'YYYY-MM-DD HH:MM:SS'.
|
| 16 |
+
|
| 17 |
+
Example:
|
| 18 |
+
>>> forward()
|
| 19 |
+
'2025-08-29 15:42:18'
|
| 20 |
+
"""
|
| 21 |
+
from datetime import datetime
|
| 22 |
+
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|