Sandiago21 commited on
Commit
7ccf8f1
·
verified ·
1 Parent(s): 11152a1

Added image display tool

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -25,6 +25,15 @@ def generate_image_by_description(image_description:str)-> Image.Image: #it's im
25
 
26
  return image
27
 
 
 
 
 
 
 
 
 
 
28
  @tool
29
  def get_current_time_in_timezone(timezone: str) -> str:
30
  """A tool that fetches the current local time in a specified timezone.
@@ -59,7 +68,7 @@ with open("prompts.yaml", 'r') as stream:
59
 
60
  agent = CodeAgent(
61
  model=model,
62
- tools=[final_answer, generate_image_by_description], ## add your tools here (don't remove final answer)
63
  max_steps=6,
64
  verbosity_level=1,
65
  grammar=None,
 
25
 
26
  return image
27
 
28
+ @tool
29
+ def display_image(image:Image.Image)-> None: #it's import to specify the return type
30
+ """A tool that displays image
31
+ Args:
32
+ image: the image to be displayed
33
+ """
34
+
35
+ image.show()
36
+
37
  @tool
38
  def get_current_time_in_timezone(timezone: str) -> str:
39
  """A tool that fetches the current local time in a specified timezone.
 
68
 
69
  agent = CodeAgent(
70
  model=model,
71
+ tools=[final_answer, generate_image_by_description, display_image], ## add your tools here (don't remove final answer)
72
  max_steps=6,
73
  verbosity_level=1,
74
  grammar=None,