DTStudios commited on
Commit
80bcb56
·
verified ·
1 Parent(s): cfc0218

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
@@ -39,24 +39,26 @@ def get_current_time_in_timezone(timezone: str) -> str:
39
  now = datetime.now(tz)
40
  return now.strftime("%Y-%m-%d %H:%M:%S %Z")
41
 
42
- final_answer = FinalAnswerTool()
43
-
44
  # 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:
45
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
46
 
47
- model = HfApiModel(model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
48
- )
 
 
 
49
 
50
  tool=[
51
  add_numbers,
52
  get_current_time_in_timezone,
53
- FinalAnswerTool(),
54
  ]
55
 
56
  agent = CodeAgent(
57
  tools=tool,
58
  model= model,
59
- add_base_tools=True,
 
 
60
  )
61
 
62
 
@@ -64,7 +66,4 @@ agent = CodeAgent(
64
 
65
 
66
  if __name__ == "__main__":
67
- # Example run
68
-
69
- from Gradio_UI import GradioUI
70
- GradioUI(agent).launch()
 
1
+ from smolagents import CodeAgent,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
 
39
  now = datetime.now(tz)
40
  return now.strftime("%Y-%m-%d %H:%M:%S %Z")
41
 
 
 
42
  # 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:
43
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
44
 
45
+ model = HfApiModel(
46
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
+ max_tokens=1024,
48
+ temperature=0.5
49
+ )
50
 
51
  tool=[
52
  add_numbers,
53
  get_current_time_in_timezone,
 
54
  ]
55
 
56
  agent = CodeAgent(
57
  tools=tool,
58
  model= model,
59
+ add_base_tools=True, # still give web_search, visit_webpage, final_answer
60
+ name="Agent Socks"
61
+ description="Practicing agent with simple math and time tools"
62
  )
63
 
64
 
 
66
 
67
 
68
  if __name__ == "__main__":
69
+ print(agent.run("What is 6 + 99, and also tell me the current time in US/Pacific"))