Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,25 @@ def reverse_and_repeat(text: str, repeat: int) -> str:
|
|
| 28 |
"""
|
| 29 |
return (text[::-1] + " ") * repeat
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 33 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -67,7 +86,8 @@ agent = CodeAgent(
|
|
| 67 |
model=model,
|
| 68 |
tools=[final_answer,
|
| 69 |
image_generation_tool,
|
| 70 |
-
reverse_and_repeat
|
|
|
|
| 71 |
], ## add your tools here (don't remove final answer)
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
|
|
|
| 28 |
"""
|
| 29 |
return (text[::-1] + " ") * repeat
|
| 30 |
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@tool
|
| 34 |
+
def create_desmos_graph(equation: str) -> str:
|
| 35 |
+
"""Creates a Desmos graph link for a given mathematical equation.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
equation: A mathematical equation (e.g., 'y = x^2').
|
| 39 |
+
|
| 40 |
+
Returns:
|
| 41 |
+
A URL string to the Desmos graph displaying the given equation.
|
| 42 |
+
"""
|
| 43 |
+
base_url = "https://www.desmos.com/calculator"
|
| 44 |
+
encoded_equation = requests.utils.quote(equation)
|
| 45 |
+
full_url = f"{base_url}?expr={encoded_equation}"
|
| 46 |
+
return f"Here is your Desmos graph: {full_url}"
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
@tool
|
| 51 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 52 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 86 |
model=model,
|
| 87 |
tools=[final_answer,
|
| 88 |
image_generation_tool,
|
| 89 |
+
reverse_and_repeat,
|
| 90 |
+
create_desmos_graph
|
| 91 |
], ## add your tools here (don't remove final answer)
|
| 92 |
max_steps=6,
|
| 93 |
verbosity_level=1,
|