karenwky commited on
Commit
c3c05dc
·
verified ·
1 Parent(s): 8ed23c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -5,6 +5,7 @@ import yaml
5
 
6
  from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
7
  from tools.final_answer import FinalAnswerTool
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
@@ -54,12 +55,15 @@ def get_current_time_in_timezone(timezone: str) -> str:
54
  except Exception as e:
55
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
56
 
57
- # Import tool from Hub
58
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
59
 
60
  # Import tool from smolagents
61
  web_search = DuckDuckGoSearchTool()
62
 
 
 
 
63
  # Function for final answer
64
  final_answer = FinalAnswerTool()
65
 
@@ -81,7 +85,7 @@ with open("prompts.yaml", 'r') as stream:
81
  # Create agent
82
  agent = CodeAgent(
83
  model=model,
84
- tools=[get_current_time_in_timezone, image_generation_tool, web_search, morse_code_translator, final_answer], # add your tools here (don't remove final answer)
85
  max_steps=6,
86
  verbosity_level=1,
87
  grammar=None,
 
5
 
6
  from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
7
  from tools.final_answer import FinalAnswerTool
8
+ from tools.visit_webpage import VisitWebpageTool
9
  from Gradio_UI import GradioUI
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
55
  except Exception as e:
56
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
57
 
58
+ # Import tools from Hub
59
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
60
 
61
  # Import tool from smolagents
62
  web_search = DuckDuckGoSearchTool()
63
 
64
+ # Import tool from custom scripts
65
+ visit_webpage = VisitWebpageTool()
66
+
67
  # Function for final answer
68
  final_answer = FinalAnswerTool()
69
 
 
85
  # Create agent
86
  agent = CodeAgent(
87
  model=model,
88
+ tools=[get_current_time_in_timezone, image_generation_tool, web_search, visit_webpage, morse_code_translator, final_answer], # add your tools here (don't remove final answer)
89
  max_steps=6,
90
  verbosity_level=1,
91
  grammar=None,