Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,12 +11,32 @@ from Gradio_UI import GradioUI
|
|
11 |
@tool
|
12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
-
"""A tool that does nothing yet
|
|
|
15 |
Args:
|
16 |
arg1: the first argument
|
17 |
arg2: the second argument
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -47,8 +67,6 @@ custom_role_conversions=None,
|
|
47 |
)
|
48 |
|
49 |
|
50 |
-
# Instantiate the duck_tool
|
51 |
-
duck_tool = DuckDuckGoSearchTool()
|
52 |
|
53 |
|
54 |
# Import tool from Hub
|
|
|
11 |
@tool
|
12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
+
#"""A tool that does nothing yet
|
15 |
+
"""A tool that search and add prefix and appendix with "#"
|
16 |
Args:
|
17 |
arg1: the first argument
|
18 |
arg2: the second argument
|
19 |
"""
|
20 |
+
|
21 |
+
# Instantiate the duck_tool
|
22 |
+
duck_tool = DuckDuckGoSearchTool()
|
23 |
+
|
24 |
+
# Define your search query
|
25 |
+
query = arg1
|
26 |
+
count = arg2
|
27 |
+
appendix = ""
|
28 |
+
prefix = ""
|
29 |
+
|
30 |
+
# Use the .run() method to perform the search
|
31 |
+
for count >= 0
|
32 |
+
appendix = appendix + "#"
|
33 |
+
prefix = "#" + prefix
|
34 |
+
|
35 |
+
search_results = appendix + duck_tool.run(query) + appendix
|
36 |
+
|
37 |
+
#return "What magic will you build ?"
|
38 |
+
return search_results
|
39 |
+
|
40 |
|
41 |
@tool
|
42 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
67 |
)
|
68 |
|
69 |
|
|
|
|
|
70 |
|
71 |
|
72 |
# Import tool from Hub
|