Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,30 +35,6 @@ def get_top_sightseeing(city: str, count: int) -> str:
|
|
| 35 |
else:
|
| 36 |
return f"No sightseeing data found for {city}."
|
| 37 |
|
| 38 |
-
@tool
|
| 39 |
-
def my_custom_tool(city:str, season:str)-> str: # it's important to specify the return type
|
| 40 |
-
"""
|
| 41 |
-
Fetches the top 5 sightseeing events in a city for a given season using Hugging Face II-Search.
|
| 42 |
-
|
| 43 |
-
Args:
|
| 44 |
-
city: Name of the city (e.g., "Paris").
|
| 45 |
-
season: Season or time of year (e.g., "summer").
|
| 46 |
-
|
| 47 |
-
Returns:
|
| 48 |
-
A formatted string listing the top 5 sightseeing events.
|
| 49 |
-
"""
|
| 50 |
-
# Query the search model
|
| 51 |
-
response_text = search_model(f"Top 5 sightseeing events in {city} during {season}")
|
| 52 |
-
|
| 53 |
-
# Split by lines to extract individual events
|
| 54 |
-
events = response_text.split("\n")
|
| 55 |
-
|
| 56 |
-
# Format output as a readable string
|
| 57 |
-
output = f"Top 5 sightseeing events in {city} during {season}:\n"
|
| 58 |
-
for i, event in enumerate(events[:5], start=1):
|
| 59 |
-
output += f"{i}. {event.strip()}\n"
|
| 60 |
-
|
| 61 |
-
return output
|
| 62 |
|
| 63 |
|
| 64 |
@tool
|
|
|
|
| 35 |
else:
|
| 36 |
return f"No sightseeing data found for {city}."
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
@tool
|