yahoo2010 commited on
Commit
1780e95
·
verified ·
1 Parent(s): 19ed52f

Update app.py

Browse files

added my_image_tool

Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -21,6 +21,12 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
21
  """
22
  return "What magic will you build ?"
23
 
 
 
 
 
 
 
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
26
  """A tool that fetches the current local time in a specified timezone.
@@ -89,7 +95,7 @@ with open("prompts.yaml", 'r') as stream:
89
 
90
  agent = CodeAgent(
91
  model=model,
92
- tools=[get_current_time_in_timezone], ## add your tools here (don't remove final answer) #1-final_answer #2-get_hugging_face_top_daily_paper #3-get_current_time_in_timezone
93
  max_steps=6,
94
  verbosity_level=1,
95
  grammar=None,
 
21
  """
22
  return "What magic will you build ?"
23
 
24
+ @tool
25
+ def my_image_tool()
26
+ client = InferenceClient()
27
+ image = client.text_to_image("A cute corgi wearing a superhero cape")
28
+ image.save("corgi_superhero.png")
29
+
30
  @tool
31
  def get_current_time_in_timezone(timezone: str) -> str:
32
  """A tool that fetches the current local time in a specified timezone.
 
95
 
96
  agent = CodeAgent(
97
  model=model,
98
+ tools=[my_image_tool], ## add your tools here (don't remove final answer) #1-final_answer #2-get_hugging_face_top_daily_paper #3-get_current_time_in_timezone
99
  max_steps=6,
100
  verbosity_level=1,
101
  grammar=None,