DragonProgrammer commited on
Commit
631ad2f
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -1,4 +1,6 @@
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
 
 
2
  import datetime
3
  import requests
4
  import pytz
@@ -7,17 +9,22 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
- # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
15
  Args:
16
- arg1: the first argument
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:
23
  """A tool that fetches the current local time in a specified timezone.
 
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
+ from googlesearch import search
3
+ from bs4 import BeautifulSoup
4
  import datetime
5
  import requests
6
  import pytz
 
9
 
10
  from Gradio_UI import GradioUI
11
 
12
+ # Sous chef that will fetch recipes off the web for you, given a food.
13
  @tool
14
+ def sous_chef(food:str)-> str: #it's import to specify the return type
15
+ """A tool that fetches recipes off the web for you
 
16
  Args:
17
+ food: the food that you want a recipe for
 
18
  """
19
+ try:
20
+ query = f"{food} recipe"
21
+ search_results = search(query, num_results=5)
22
+
23
+ for url in search_results:
24
+ if "allrecipes.com" in url:
25
+ print("Here's the top result:" + url)
26
 
27
+ # Tutorial tool that fetches the time in a timezone.
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.