Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
|
|
@@ -34,10 +35,11 @@ def get_fun_fact(topic: str) -> str:
|
|
| 34 |
"""
|
| 35 |
try:
|
| 36 |
search_tool=DuckDuckGoSearchTool(max_results=1)
|
| 37 |
-
|
| 38 |
-
if
|
| 39 |
-
|
| 40 |
-
|
|
|
|
| 41 |
else:
|
| 42 |
return f"Sorry, I could not find a fun fact about {topic}."
|
| 43 |
except Exception as e:
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
from tools.visit_webpage import VisitWebpageTool
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
| 35 |
"""
|
| 36 |
try:
|
| 37 |
search_tool=DuckDuckGoSearchTool(max_results=1)
|
| 38 |
+
url = search_tool.forward(f"fun fact about {topic}")
|
| 39 |
+
if url:
|
| 40 |
+
visit_web_page=VisitWebpageTool()
|
| 41 |
+
fun_fact=visit_web_page.forward(url)
|
| 42 |
+
return f"Here's a fun fact about {topic}: {fun_fact[:300]}"
|
| 43 |
else:
|
| 44 |
return f"Sorry, I could not find a fun fact about {topic}."
|
| 45 |
except Exception as e:
|