petkar commited on
Commit
a6b7c7e
·
verified ·
1 Parent(s): e9d3846

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -7,7 +7,8 @@ from tools.final_answer import FinalAnswerTool
7
  import requests
8
  from bs4 import BeautifulSoup
9
  from Gradio_UI import GradioUI
10
-
 
11
 
12
  # Initialize the Hugging Face web search model
13
  search_model = HfApiModel(
@@ -17,8 +18,6 @@ search_model = HfApiModel(
17
  )
18
 
19
 
20
-
21
-
22
  @tool
23
  def get_top_sightseeing(city: str, count: int) -> str:
24
  """Searches the web for top sightseeing locations in a given city.
@@ -28,13 +27,11 @@ def get_top_sightseeing(city: str, count: int) -> str:
28
  """
29
  search_tool = DuckDuckGoSearchTool()
30
  query = f"top {count} sightseeing locations in {city}"
31
- results = search_tool.search(query)
32
-
33
- if results:
34
- return f"Top sightseeing locations in {city}:\n" + "\n".join(f"{i+1}. {r['title']}" for i, r in enumerate(results[:count]))
35
- else:
36
- return f"No sightseeing data found for {city}."
37
-
38
 
39
 
40
  @tool
 
7
  import requests
8
  from bs4 import BeautifulSoup
9
  from Gradio_UI import GradioUI
10
+ from crewai_tools import DuckDuckGoSearchTool
11
+ from crewai import tool
12
 
13
  # Initialize the Hugging Face web search model
14
  search_model = HfApiModel(
 
18
  )
19
 
20
 
 
 
21
  @tool
22
  def get_top_sightseeing(city: str, count: int) -> str:
23
  """Searches the web for top sightseeing locations in a given city.
 
27
  """
28
  search_tool = DuckDuckGoSearchTool()
29
  query = f"top {count} sightseeing locations in {city}"
30
+
31
+ # Bei CrewAI rufst du das Tool direkt auf oder nutzt .run()
32
+ results = search_tool.run(query)
33
+
34
+ return f"Top sightseeing locations in {city}:\n{results}"
 
 
35
 
36
 
37
  @tool