Spaces:
Sleeping
Sleeping
Upload tool
Browse files- requirements.txt +1 -1
- tool.py +2 -2
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
smolagents
|
2 |
pytz
|
|
|
|
|
|
1 |
pytz
|
2 |
+
smolagents
|
tool.py
CHANGED
@@ -9,7 +9,7 @@ class GetTime(Tool):
|
|
9 |
inputs = {'tz': {'type': 'string', 'description': 'the timezone (such as Asia/Shanghai, Europe/Amsterdam, etc.)'}}
|
10 |
output_type = "string"
|
11 |
|
12 |
-
def forward(self, tz: str) ->
|
13 |
"""Get the current time in a specific timezone.
|
14 |
|
15 |
Args:
|
@@ -18,7 +18,7 @@ class GetTime(Tool):
|
|
18 |
import pytz
|
19 |
from datetime import datetime
|
20 |
|
21 |
-
return datetime.now(pytz.timezone(tz))
|
22 |
|
23 |
def __init__(self, *args, **kwargs):
|
24 |
self.is_initialized = False
|
|
|
9 |
inputs = {'tz': {'type': 'string', 'description': 'the timezone (such as Asia/Shanghai, Europe/Amsterdam, etc.)'}}
|
10 |
output_type = "string"
|
11 |
|
12 |
+
def forward(self, tz: str) -> str:
|
13 |
"""Get the current time in a specific timezone.
|
14 |
|
15 |
Args:
|
|
|
18 |
import pytz
|
19 |
from datetime import datetime
|
20 |
|
21 |
+
return datetime.now(pytz.timezone(tz)).strftime("%Y-%m-%d %H:%M:%S")
|
22 |
|
23 |
def __init__(self, *args, **kwargs):
|
24 |
self.is_initialized = False
|