Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,27 +8,21 @@ from tools.final_answer import FinalAnswerTool
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
@tool
|
11 |
-
def
|
12 |
"""
|
13 |
-
|
14 |
|
15 |
Args:
|
16 |
-
|
17 |
|
18 |
Returns:
|
19 |
-
str:
|
20 |
"""
|
21 |
try:
|
22 |
# Perform a DuckDuckGo search
|
23 |
-
|
24 |
-
search_results = search_tool(query=query, max_results=3)
|
25 |
|
26 |
-
|
27 |
-
if search_results and isinstance(search_results, list):
|
28 |
-
summary = "\n".join([f"{res['title']}: {res.get('body', 'No description')}" for res in search_results])
|
29 |
-
return summary
|
30 |
-
else:
|
31 |
-
return "No relevant results found."
|
32 |
|
33 |
except Exception as e:
|
34 |
return f"Error fetching search results: {str(e)}"
|
@@ -70,7 +64,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
70 |
|
71 |
agent = CodeAgent(
|
72 |
model=model,
|
73 |
-
tools=[
|
74 |
max_steps=6,
|
75 |
verbosity_level=1,
|
76 |
grammar=None,
|
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
@tool
|
11 |
+
def dream_image_generator(dream_desc: str) -> str:
|
12 |
"""
|
13 |
+
Generates an image of an dream based on user description.
|
14 |
|
15 |
Args:
|
16 |
+
dream_desc (str): Dream description.
|
17 |
|
18 |
Returns:
|
19 |
+
str: URL or path to the AI-generated dream image.
|
20 |
"""
|
21 |
try:
|
22 |
# Perform a DuckDuckGo search
|
23 |
+
dream_image = image_generation_tool(f"A surreal dream {dream_desc}")
|
|
|
24 |
|
25 |
+
return dream_image
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
except Exception as e:
|
28 |
return f"Error fetching search results: {str(e)}"
|
|
|
64 |
|
65 |
agent = CodeAgent(
|
66 |
model=model,
|
67 |
+
tools=[dream_image_generator, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
|
68 |
max_steps=6,
|
69 |
verbosity_level=1,
|
70 |
grammar=None,
|