soaljack commited on
Commit
46cbfa1
·
verified ·
1 Parent(s): 511af3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -23
app.py CHANGED
@@ -8,20 +8,17 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
- def is_prime(num:int) -> str:
12
- """A tool that detemines if an inputed number is prime and retuns a boolean
13
  Args:
14
- num: A int that is to be checked for being prime
15
  """
16
 
17
  try:
18
- prime = check_prime(num)
19
- if(prime):
20
- return f"The number {num} is Prime!!!"
21
- else:
22
- return f"The number {num} is not Prime :("
23
  except Exception as e:
24
- return f"Error calculating primeness '{num}': {str(e)}"
25
 
26
 
27
  @tool
@@ -61,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
61
 
62
  agent = CodeAgent(
63
  model=model,
64
- tools=[final_answer, is_prime, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
65
  max_steps=6,
66
  verbosity_level=1,
67
  grammar=None,
@@ -71,19 +68,20 @@ agent = CodeAgent(
71
  prompt_templates=prompt_templates
72
  )
73
 
74
- def check_prime(n):
75
- if n <= 1:
76
- return False
77
- if n <= 3:
78
- return True
79
- if n % 2 == 0 or n % 3 == 0:
80
- return False
81
- i = 5
82
- while i * i <= n:
83
- if n % i == 0 or n % (i + 2) == 0:
84
- return False
85
- i = i + 6
86
- return True
 
87
 
88
 
89
  GradioUI(agent).launch()
 
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
+ def plus_plus(num1:int) -> str:
12
+ """A tool that detemines the next int by adding one to it
13
  Args:
14
+ num: A int to be added to
15
  """
16
 
17
  try:
18
+ next_int = int + 1
19
+ return f"The number {num} ++ is {next_int}"
 
 
 
20
  except Exception as e:
21
+ return f"Error calculating plus plus for '{num}': {str(e)}"
22
 
23
 
24
  @tool
 
58
 
59
  agent = CodeAgent(
60
  model=model,
61
+ tools=[final_answer, plus_plus, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,
 
68
  prompt_templates=prompt_templates
69
  )
70
 
71
+
72
+ ## def check_prime(n):
73
+ ## if n <= 1:
74
+ ## return False
75
+ ## if n <= 3:
76
+ ## return True
77
+ ## if n % 2 == 0 or n % 3 == 0:
78
+ ## return False
79
+ ## i = 5
80
+ ## while i * i <= n:
81
+ ## if n % i == 0 or n % (i + 2) == 0:
82
+ ## return False
83
+ ## i = i + 6
84
+ ## return True
85
 
86
 
87
  GradioUI(agent).launch()