Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
@@ -41,7 +42,9 @@ def get_wiki_summary(query1: str) -> str:
|
|
| 41 |
"""
|
| 42 |
try:
|
| 43 |
wikipedia.set_lang("en")
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
return summary
|
| 46 |
except Exception as e:
|
| 47 |
return f"No page found for that topic"
|
|
|
|
| 1 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
import wikipedia
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
|
|
|
| 42 |
"""
|
| 43 |
try:
|
| 44 |
wikipedia.set_lang("en")
|
| 45 |
+
search_results = wikipedia.search(query1)
|
| 46 |
+
page = wikipedia.page(search_results[0])
|
| 47 |
+
summary = page.summary()
|
| 48 |
return summary
|
| 49 |
except Exception as e:
|
| 50 |
return f"No page found for that topic"
|