Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,19 @@ 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 |
web_search = DuckDuckGoSearchTool()
|
| 39 |
visit_webpage = VisitWebpageTool()
|
|
@@ -58,7 +71,8 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
-
tools=[my_custom_tool, get_current_time_in_timezone, web_search, final_answer,
|
|
|
|
| 62 |
max_steps=6,
|
| 63 |
verbosity_level=1,
|
| 64 |
grammar=None,
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 36 |
|
| 37 |
+
@tool
|
| 38 |
+
def generate_accompaniment(requirement: str) -> str:
|
| 39 |
+
"""A tool that generate accompaniment in ABC notation format based on the requirement.
|
| 40 |
+
Args:
|
| 41 |
+
requirement: A string describing the accompaniment requirement (e.g., 'jazz piano accompaniment').
|
| 42 |
+
"""
|
| 43 |
+
return """X:1
|
| 44 |
+
T:Frère Jacques
|
| 45 |
+
M:4/4
|
| 46 |
+
L:1/8
|
| 47 |
+
K:F
|
| 48 |
+
F2 G2 A2 F2 | F2 G2 A2 F2 | A2 B2 c4 | A2 B2 c4 |
|
| 49 |
+
cd cB A2 F2 | cd cB A2 F2 | G2 C2 F4 | G2 C2 F4 ||"""
|
| 50 |
|
| 51 |
web_search = DuckDuckGoSearchTool()
|
| 52 |
visit_webpage = VisitWebpageTool()
|
|
|
|
| 71 |
|
| 72 |
agent = CodeAgent(
|
| 73 |
model=model,
|
| 74 |
+
tools=[my_custom_tool, get_current_time_in_timezone, web_search, final_answer,
|
| 75 |
+
visit_webpage, image_generation_tool, generate_accompaniment], ## add your tools here (don't remove final answer)
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|