eocone commited on
Commit
9ac51b4
·
verified ·
1 Parent(s): c97cae7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -9,16 +9,16 @@ from Gradio_UI import GradioUI
9
 
10
  #my first try
11
  @tool
12
- def dog_average_longevity(dog_breed: str)-> str:
13
  """A tool that uses DuckDuckGo to search the web and find the average lifespan in years for a given dog breed.
14
 
15
  Tool name : dog_average_longevity
16
  Args:
17
- arg1: dog_breed : a string representing the name of the dog breed.
18
 
19
  return : The extracted average lifespan of a dog breed in years or a fallback message.
20
  """
21
- query = f"average lifespan for {dog_breed} dog in years"
22
 
23
  with DDGS() as ddgs:
24
  results = list(ddgs.text(query, max_results=5))
@@ -27,7 +27,7 @@ def dog_average_longevity(dog_breed: str)-> str:
27
  for result in results:
28
  lifespan = extract_lifespan(result)
29
  if lifespan:
30
- return f"The average lifespan of a {dog_breed} is {lifespan} years."
31
 
32
  return "No reliable lifespan information found. Please check with a veterinarian."
33
 
 
9
 
10
  #my first try
11
  @tool
12
+ def dog_average_longevity(breed: str)-> str:
13
  """A tool that uses DuckDuckGo to search the web and find the average lifespan in years for a given dog breed.
14
 
15
  Tool name : dog_average_longevity
16
  Args:
17
+ arg1: breed : a string representing the name of the dog breed.
18
 
19
  return : The extracted average lifespan of a dog breed in years or a fallback message.
20
  """
21
+ query = f"average lifespan for {breed} dog in years"
22
 
23
  with DDGS() as ddgs:
24
  results = list(ddgs.text(query, max_results=5))
 
27
  for result in results:
28
  lifespan = extract_lifespan(result)
29
  if lifespan:
30
+ return f"The average lifespan of a {breed} dog is {lifespan} years."
31
 
32
  return "No reliable lifespan information found. Please check with a veterinarian."
33