safia-8 commited on
Commit
4197fd3
·
verified ·
1 Parent(s): d7d8bd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -18
app.py CHANGED
@@ -7,30 +7,32 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
- # Below is an example of a tool that does nothing. Amaze us with your creativity !
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
- search=DuckDuckGoSearchTool()
20
- result=search.run(arg1, max_results=3)
21
- return result
22
-
23
  @tool
24
- def my_custom_tool2(arg1:str, arg2:int=3)-> str: #it's import to specify the return type
25
- #Keep this format for the description / args / args description but feel free to modify the tool
26
- """A tool that does nothing yet
27
  Args:
28
- arg1: the first argument
29
- arg2: the second argument
 
 
30
  """
31
- im=image_generation_tool()
32
- result=im.run(arg1,max_results=arg2)
33
- return result
34
 
35
 
36
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+
11
  @tool
12
+ def my_custom_tool(query: str, max_results: int = 3) -> list[str]:
13
+ """
14
+ Search DuckDuckGo and return up to max_results hits.
15
  Args:
16
+ query: the search query
17
+ max_results: how many results to return
18
+ Returns:
19
+ A list of result snippets or URLs.
20
  """
21
+ search = DuckDuckGoSearchTool()
22
+ return search.run(query, max_results=max_results)
23
+
 
24
  @tool
25
+ def generate_images(prompt: str, n: int = 3) -> list[str]:
26
+ """
27
+ Generate up to n images matching the prompt.
28
  Args:
29
+ prompt: the text description for the image
30
+ n: number of images to generate
31
+ Returns:
32
+ A list of image asset IDs.
33
  """
34
+ image_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
35
+ return image_tool.run(prompt, max_results=n)
 
36
 
37
 
38