Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,20 +8,17 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
@tool
|
| 11 |
-
def
|
| 12 |
-
"""A tool that detemines
|
| 13 |
Args:
|
| 14 |
-
num: A int
|
| 15 |
"""
|
| 16 |
|
| 17 |
try:
|
| 18 |
-
|
| 19 |
-
|
| 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
|
| 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,
|
| 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 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
| 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()
|