Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,13 +24,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 24 |
Args:
|
| 25 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 26 |
"""
|
| 27 |
-
@tool
|
| 28 |
-
def get_city_image(arg3: str) -> str:
|
| 29 |
-
"""A tool that fetches the stated city name and draws them.
|
| 30 |
-
Args:
|
| 31 |
-
arg3: A string representing a valid city name (e.g., 'Lagos').
|
| 32 |
-
"""
|
| 33 |
-
return f"Generated an artistic illustration of the city: {arg3}."
|
| 34 |
try:
|
| 35 |
# Create timezone object
|
| 36 |
tz = pytz.timezone(timezone)
|
|
@@ -39,6 +32,13 @@ def get_city_image(arg3: str) -> str:
|
|
| 39 |
return f"The current local time in {timezone} is: {local_time}"
|
| 40 |
except Exception as e:
|
| 41 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
final_answer = FinalAnswerTool()
|
|
@@ -63,7 +63,11 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 63 |
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
-
tools=[final_answer,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
max_steps=6,
|
| 68 |
verbosity_level=1,
|
| 69 |
grammar=None,
|
|
|
|
| 24 |
Args:
|
| 25 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 26 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
try:
|
| 28 |
# Create timezone object
|
| 29 |
tz = pytz.timezone(timezone)
|
|
|
|
| 32 |
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
+
@tool
|
| 36 |
+
def get_city_image(arg3: str) -> str:
|
| 37 |
+
"""A tool that fetches the stated city name and draws them.
|
| 38 |
+
Args:
|
| 39 |
+
arg3: A string representing a valid city name (e.g., 'Lagos').
|
| 40 |
+
"""
|
| 41 |
+
return f"Generated an artistic illustration of the city: {arg3}."
|
| 42 |
|
| 43 |
|
| 44 |
final_answer = FinalAnswerTool()
|
|
|
|
| 63 |
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
+
tools=[final_answer,
|
| 67 |
+
image_generation_tool,
|
| 68 |
+
my_custom_tool,
|
| 69 |
+
get_current_time_in_timezone,
|
| 70 |
+
get_city_image], ## add your tools here (don't remove final answer)
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|