Spaces:
Sleeping
Sleeping
added tools
Browse files
app.py
CHANGED
|
@@ -13,10 +13,13 @@ import subprocess
|
|
| 13 |
def get_image_info(arg1:str)-> str:
|
| 14 |
"""A tool that provides basic information about a given image file, like it's file name, image format, resolution etc.
|
| 15 |
Args:
|
| 16 |
-
arg1: the first argument- path/name of the image file that we want to get info about.
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -55,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 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,
|
|
|
|
| 13 |
def get_image_info(arg1:str)-> str:
|
| 14 |
"""A tool that provides basic information about a given image file, like it's file name, image format, resolution etc.
|
| 15 |
Args:
|
| 16 |
+
arg1: the first argument- path/name of the image file that we want to get info about.
|
| 17 |
"""
|
| 18 |
+
try:
|
| 19 |
+
out = subprocess.run(["file", arg1], capture_output=True)
|
| 20 |
+
return str(out.stdout)
|
| 21 |
+
except Exception as e:
|
| 22 |
+
return "No information found."
|
| 23 |
|
| 24 |
@tool
|
| 25 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
+
tools=[final_answer, get_image_info, 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,
|