Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,14 +9,17 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
-
def
|
13 |
-
|
14 |
-
|
|
|
15 |
Args:
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
"""
|
19 |
-
return
|
20 |
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -57,7 +60,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
57 |
|
58 |
agent = CodeAgent(
|
59 |
model=model,
|
60 |
-
tools=[duckduckgo_search, get_current_time_in_timezone,final_answer], ## add your tools here (don't remove final answer)
|
61 |
max_steps=6,
|
62 |
verbosity_level=1,
|
63 |
grammar=None,
|
@@ -66,7 +69,7 @@ agent = CodeAgent(
|
|
66 |
description=None,
|
67 |
prompt_templates=prompt_templates
|
68 |
)
|
69 |
-
result = agent.run("Generate an image of a sunrise over mountains, then tell me the current time in Tokyo.")
|
70 |
print(result)
|
71 |
|
72 |
GradioUI(agent).launch()
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def temperature_covert(celsius: float) -> float: #it's import to specify the return type
|
13 |
+
"""
|
14 |
+
Convert Celsius temperature to Fahrenheit.
|
15 |
+
|
16 |
Args:
|
17 |
+
celsius: Temperature in degrees Celsius.
|
18 |
+
|
19 |
+
Returns:
|
20 |
+
float: Temperature converted to Fahrenheit.
|
21 |
"""
|
22 |
+
return (celsius * 9/5) + 32
|
23 |
|
24 |
@tool
|
25 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
60 |
|
61 |
agent = CodeAgent(
|
62 |
model=model,
|
63 |
+
tools=[duckduckgo_search, get_current_time_in_timezone,temperature_covert,image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
|
64 |
max_steps=6,
|
65 |
verbosity_level=1,
|
66 |
grammar=None,
|
|
|
69 |
description=None,
|
70 |
prompt_templates=prompt_templates
|
71 |
)
|
72 |
+
result = agent.run("Generate an image of a sunrise over mountains, then tell me the current time, and weather in Fahrenheit in Tokyo.")
|
73 |
print(result)
|
74 |
|
75 |
GradioUI(agent).launch()
|