Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 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
|