Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,20 +33,12 @@ def get_weather(lat: float, lon: float) -> dict | None:
|
|
| 33 |
print(f"Weather API Error: {e}")
|
| 34 |
return None
|
| 35 |
|
| 36 |
-
# Hàm chuyển đổi địa điểm thành tọa độ
|
| 37 |
-
@tool
|
| 38 |
-
def get_coordinates(location: str) -> tuple[float, float] | None:
|
| 39 |
-
"""Convert location name to geographic coordinates"""
|
| 40 |
-
geolocator = Nominatim(user_agent="weather_agent")
|
| 41 |
-
location = geolocator.geocode(location)
|
| 42 |
-
return (location.latitude, location.longitude) if location else None
|
| 43 |
|
| 44 |
# Khởi tạo agent
|
| 45 |
weather_agent = CodeAgent(
|
| 46 |
model=HfApiModel("deepseek-ai/DeepSeek-R1", max_tokens=8096),
|
| 47 |
tools=[
|
| 48 |
get_weather,
|
| 49 |
-
get_coordinates,
|
| 50 |
GoogleSearchTool(provider="serper", api_key=SERPER_API_KEY),
|
| 51 |
VisitWebpageTool()
|
| 52 |
],
|
|
|
|
| 33 |
print(f"Weather API Error: {e}")
|
| 34 |
return None
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Khởi tạo agent
|
| 38 |
weather_agent = CodeAgent(
|
| 39 |
model=HfApiModel("deepseek-ai/DeepSeek-R1", max_tokens=8096),
|
| 40 |
tools=[
|
| 41 |
get_weather,
|
|
|
|
| 42 |
GoogleSearchTool(provider="serper", api_key=SERPER_API_KEY),
|
| 43 |
VisitWebpageTool()
|
| 44 |
],
|