Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ 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 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
@@ -17,19 +17,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
-
@tool
|
| 21 |
-
def basic_statistics(numbers:list[float]) -> str:
|
| 22 |
-
"""this function calculates the mean,median,mode for the provided list of numbers
|
| 23 |
-
Args:
|
| 24 |
-
numbers: a list of numbers
|
| 25 |
-
"""
|
| 26 |
-
try:
|
| 27 |
-
avg = statistics.mean(numbers)
|
| 28 |
-
med = statistics.median(numbers)
|
| 29 |
-
mod = statistics.mode(numbers)
|
| 30 |
-
return f"stats for your provided numbers are average/mean : {avg}\n median : {med} \n mode : {mod}\n "
|
| 31 |
-
except Exception as e:
|
| 32 |
-
return f"error in processing:{str(e)} "
|
| 33 |
|
| 34 |
@tool
|
| 35 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -68,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
-
tools=[final_answer
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|
|
|
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
+
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
|
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
+
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|