BoddyGus commited on
Commit
3ed4935
·
verified ·
1 Parent(s): 34d59ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -9
app.py CHANGED
@@ -8,10 +8,8 @@ from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
10
 
11
- # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
14
- #Keep this format for the description / args / args description but feel free to modify the tool
15
  """A tool that does nothing yet
16
  Args:
17
  arg1: the first argument
@@ -26,9 +24,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
26
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
27
  """
28
  try:
29
- # Create timezone object
30
  tz = pytz.timezone(timezone)
31
- # Get current time in that timezone
32
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
33
  return f"The current local time in {timezone} is: {local_time}"
34
  except Exception as e:
@@ -37,8 +33,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
37
 
38
  final_answer = FinalAnswerTool()
39
 
40
- # 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:
41
- # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
42
 
43
  model = HfApiModel(
44
  max_tokens=2096,
@@ -48,7 +42,6 @@ custom_role_conversions=None,
48
  )
49
 
50
 
51
- # Import tool from Hub
52
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
53
 
54
  with open("prompts.yaml", 'r') as stream:
@@ -56,7 +49,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
8
 
9
  from Gradio_UI import GradioUI
10
 
 
11
  @tool
12
+ def my_custom_tool(arg1:str, arg2:int)-> str:
 
13
  """A tool that does nothing yet
14
  Args:
15
  arg1: the first argument
 
24
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
25
  """
26
  try:
 
27
  tz = pytz.timezone(timezone)
 
28
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
29
  return f"The current local time in {timezone} is: {local_time}"
30
  except Exception as e:
 
33
 
34
  final_answer = FinalAnswerTool()
35
 
 
 
36
 
37
  model = HfApiModel(
38
  max_tokens=2096,
 
42
  )
43
 
44
 
 
45
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
46
 
47
  with open("prompts.yaml", 'r') as stream:
 
49
 
50
  agent = CodeAgent(
51
  model=model,
52
+ tools=[final_answer],
53
  max_steps=6,
54
  verbosity_level=1,
55
  grammar=None,