Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,30 +7,32 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
-
|
| 11 |
@tool
|
| 12 |
-
def my_custom_tool(
|
| 13 |
-
|
| 14 |
-
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
search=DuckDuckGoSearchTool()
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
@tool
|
| 24 |
-
def
|
| 25 |
-
|
| 26 |
-
|
| 27 |
Args:
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
"""
|
| 31 |
-
|
| 32 |
-
|
| 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 |
|