Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
final_answer = FinalAnswerTool()
|
| 39 |
|
|
@@ -56,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 56 |
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
-
tools=[final_answer,get_current_time_in_timezone,
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 36 |
|
| 37 |
+
def generate_image(description: str) -> str:
|
| 38 |
+
"""A tool to generate images based on a text prompt.
|
| 39 |
+
|
| 40 |
+
Args:
|
| 41 |
+
prompt: The description of the image to generate.
|
| 42 |
+
|
| 43 |
+
Returns:
|
| 44 |
+
A URL or file path of the generated image.
|
| 45 |
+
"""
|
| 46 |
+
return image_generation_tool(prompt)
|
| 47 |
|
| 48 |
final_answer = FinalAnswerTool()
|
| 49 |
|
|
|
|
| 66 |
|
| 67 |
agent = CodeAgent(
|
| 68 |
model=model,
|
| 69 |
+
tools=[final_answer,get_current_time_in_timezone,generate_image], ## add your tools here (don't remove final answer)
|
| 70 |
max_steps=6,
|
| 71 |
verbosity_level=1,
|
| 72 |
grammar=None,
|