Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
-
import
|
| 10 |
|
| 11 |
@tool
|
| 12 |
def wikipedia_summary(topic: str) -> str:
|
|
@@ -20,13 +20,14 @@ def wikipedia_summary(topic: str) -> str:
|
|
| 20 |
Returns:
|
| 21 |
str: A summary of the Wikipedia article.
|
| 22 |
"""
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
+
import wikipediaapi
|
| 10 |
|
| 11 |
@tool
|
| 12 |
def wikipedia_summary(topic: str) -> str:
|
|
|
|
| 20 |
Returns:
|
| 21 |
str: A summary of the Wikipedia article.
|
| 22 |
"""
|
| 23 |
+
wiki = wikipediaapi.Wikipedia(language="en", user_agent="MyWikipediaBot/1.0")
|
| 24 |
+
page = wiki.page(topic)
|
| 25 |
+
|
| 26 |
+
if page.exists():
|
| 27 |
+
page_content = page.summary
|
| 28 |
+
return page_content
|
| 29 |
+
else:
|
| 30 |
+
return "Page not found"
|
| 31 |
|
| 32 |
@tool
|
| 33 |
def get_current_time_in_timezone(timezone: str) -> str:
|