Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ from tools.final_answer import FinalAnswerTool
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
|
|
10 |
@tool
|
11 |
def my_custom_tool(arg1:str, arg2:int)-> str: # it's important to specify the return type
|
12 |
# Keep this format for the tool description / args description but feel free to modify the tool
|
@@ -32,25 +33,25 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
32 |
except Exception as e:
|
33 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
34 |
|
|
|
35 |
final_answer = FinalAnswerTool()
|
36 |
model = HfApiModel(
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
)
|
42 |
|
|
|
43 |
# Import tool from Hub
|
44 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
45 |
|
46 |
with open("prompts.yaml", 'r') as stream:
|
47 |
prompt_templates = yaml.safe_load(stream)
|
48 |
|
49 |
-
# We're creating our CodeAgent
|
50 |
agent = CodeAgent(
|
51 |
model=model,
|
52 |
-
|
53 |
-
tools=[final_answer,image_generation_tool,DuckDuckGoSearchTool],
|
54 |
max_steps=6,
|
55 |
verbosity_level=1,
|
56 |
grammar=None,
|
@@ -60,4 +61,5 @@ agent = CodeAgent(
|
|
60 |
prompt_templates=prompt_templates
|
61 |
)
|
62 |
|
63 |
-
|
|
|
|
7 |
|
8 |
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 my_custom_tool(arg1:str, arg2:int)-> str: # it's important to specify the return type
|
13 |
# Keep this format for the tool description / args description but feel free to modify the tool
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
|
37 |
final_answer = FinalAnswerTool()
|
38 |
model = HfApiModel(
|
39 |
+
max_tokens=2096,
|
40 |
+
temperature=0.5,
|
41 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
42 |
+
custom_role_conversions=None,
|
43 |
)
|
44 |
|
45 |
+
|
46 |
# Import tool from Hub
|
47 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
48 |
|
49 |
with open("prompts.yaml", 'r') as stream:
|
50 |
prompt_templates = yaml.safe_load(stream)
|
51 |
|
|
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
+
tools=[final_answer], # add your tools here (don't remove final_answer)
|
|
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|
|
|
61 |
prompt_templates=prompt_templates
|
62 |
)
|
63 |
|
64 |
+
|
65 |
+
GradioUI(agent).launch()
|