yahoo2010 commited on
Commit
0d4e9a4
·
verified ·
1 Parent(s): 22ec939

Update app.py

Browse files

added DuckDuckGoSearchTool()

Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -9,8 +9,8 @@ from Gradio_UI import GradioUI
9
 
10
  from bs4 import BeautifulSoup
11
  import json
12
- from huggingface_hub import InferenceClient
13
- from PIL import Image
14
 
15
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
16
  @tool
@@ -23,12 +23,12 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
23
  """
24
  return "What magic will you build ?"
25
 
26
- @tool
27
- def my_image_tool(prompt:str) -> Image: #A cute corgi wearing a superhero cape
28
- client = InferenceClient()
29
- image = client.text_to_image(prompt)
30
- #image.save("corgi_superhero.png")
31
- return image
32
 
33
  @tool
34
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -98,7 +98,7 @@ with open("prompts.yaml", 'r') as stream:
98
 
99
  agent = CodeAgent(
100
  model=model,
101
- 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
102
  max_steps=6,
103
  verbosity_level=1,
104
  grammar=None,
 
9
 
10
  from bs4 import BeautifulSoup
11
  import json
12
+ #from huggingface_hub import InferenceClient
13
+ #from PIL import Image
14
 
15
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
16
  @tool
 
23
  """
24
  return "What magic will you build ?"
25
 
26
+ #@tool
27
+ #def my_image_tool(prompt:str) -> Image: #A cute corgi wearing a superhero cape
28
+ # client = InferenceClient()
29
+ # image = client.text_to_image(prompt)
30
+ # #image.save("corgi_superhero.png")
31
+ # return image
32
 
33
  @tool
34
  def get_current_time_in_timezone(timezone: str) -> str:
 
98
 
99
  agent = CodeAgent(
100
  model=model,
101
+ tools=[DuckDuckGoSearchTool()], ## 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
102
  max_steps=6,
103
  verbosity_level=1,
104
  grammar=None,