m-ric HF staff commited on
Commit
fd6790e
·
verified ·
1 Parent(s): 9bb5689

Upload tool

Browse files
Files changed (4) hide show
  1. app.py +2 -2
  2. requirements.txt +2 -25
  3. tool.py +14 -0
  4. tool_config.json +1 -1
app.py CHANGED
@@ -1,4 +1,4 @@
1
  from transformers import launch_gradio_demo
2
- from tools import Get_current_timeTool
3
 
4
- launch_gradio_demo(Get_current_timeTool)
 
1
  from transformers import launch_gradio_demo
2
+ from tool import GetCurrentTime
3
 
4
+ launch_gradio_demo(GetCurrentTime)
requirements.txt CHANGED
@@ -1,25 +1,2 @@
1
- my_tool_module
2
- transformers
3
- importlib
4
- uuid
5
- io
6
- huggingface_hub
7
- inspect
8
- builtins
9
- pathlib
10
- os
11
- PIL
12
- functools
13
- torch
14
- typing
15
- {module_name}
16
- packaging
17
- gradio_client
18
- ast
19
- IPython
20
- json
21
- logging
22
- base64
23
- accelerate
24
- textwrap
25
- tempfile
 
1
+ agents_package
2
+ datetime
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tool.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from agents import Tool
2
+
3
+ class GetCurrentTime(Tool):
4
+ name = "get_current_time"
5
+ description = "Gets the current time."
6
+ inputs = {}
7
+ output_type = "string"
8
+
9
+ def forward(self) -> str:
10
+ """
11
+ Gets the current time.
12
+ """
13
+ from datetime import datetime
14
+ return datetime.now().strftime()
tool_config.json CHANGED
@@ -3,5 +3,5 @@
3
  "inputs": {},
4
  "name": "get_current_time",
5
  "output_type": "string",
6
- "tool_class": "tools.Get_current_timeTool"
7
  }
 
3
  "inputs": {},
4
  "name": "get_current_time",
5
  "output_type": "string",
6
+ "tool_class": "GetCurrentTime"
7
  }