Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -33,6 +33,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
|
|
| 1 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, wikipedia
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
@tool
|
| 37 |
+
def get_wiki_summary(query1: str) -> str:
|
| 38 |
+
"""A tool that provides summary from wikipedia for a particular query.
|
| 39 |
+
Args:
|
| 40 |
+
query1: A string representing a valid title for Wikipedia (e.g., "Donald Trump")
|
| 41 |
+
"""
|
| 42 |
+
try:
|
| 43 |
+
wikipedia.set_lang("en")
|
| 44 |
+
summary = get_wiki_summary(query1)
|
| 45 |
+
return summary
|
| 46 |
+
except Exception as e:
|
| 47 |
+
return f"No page found for that topic"
|
| 48 |
+
|
| 49 |
|
| 50 |
final_answer = FinalAnswerTool()
|
| 51 |
|