VictorHueni commited on
Commit
09aa113
·
verified ·
1 Parent(s): c52ca60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -1,10 +1,9 @@
1
- from smolagents import CodeAgent,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
- from tools.web_search import DuckDuckGoSearchTool
8
  from tools.visit_webpage import VisitWebpageTool
9
 
10
  from Gradio_UI import GradioUI
@@ -35,11 +34,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
35
  except Exception as e:
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
38
-
39
- final_answer = FinalAnswerTool()
40
- duckduckgo_search = DuckDuckGoSearchTool()
41
- webpage_visit = VisitWebpageTool()
42
-
43
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
44
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
45
 
@@ -51,6 +45,11 @@ custom_role_conversions=None,
51
  )
52
 
53
 
 
 
 
 
 
54
  # Import tool from Hub
55
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
56
 
@@ -59,7 +58,13 @@ with open("prompts.yaml", 'r') as stream:
59
 
60
  agent = CodeAgent(
61
  model=model,
62
- tools=[get_current_time_in_timezone, duckduckgo_search, webpage_visit, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
 
 
 
 
 
 
63
  max_steps=6,
64
  verbosity_level=1,
65
  grammar=None,
 
1
+ from smolagents import CodeAgent,DuckDuckGoSearchTool,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
  from tools.visit_webpage import VisitWebpageTool
8
 
9
  from Gradio_UI import GradioUI
 
34
  except Exception as e:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
 
 
 
 
 
37
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
38
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
39
 
 
45
  )
46
 
47
 
48
+ # Create tools
49
+ final_answer = FinalAnswerTool()
50
+ visit_webpage = VisitWebpageTool()
51
+ duckduckgo_search = DuckDuckGoSearchTool()
52
+
53
  # Import tool from Hub
54
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
55
 
 
58
 
59
  agent = CodeAgent(
60
  model=model,
61
+ tools=[
62
+ final_answer,
63
+ get_current_time_in_timezone,
64
+ image_generation_tool,
65
+ visit_webpage,
66
+ duckduckgo_search,
67
+ ],
68
  max_steps=6,
69
  verbosity_level=1,
70
  grammar=None,