Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from smolagents import CodeAgent, HfApiModel,load_tool,tool
|
| 2 |
-
from
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
@@ -16,7 +16,8 @@ def search_web(query:str)-> str:
|
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
with DDGS() as ddgs:
|
| 19 |
-
results =
|
|
|
|
| 20 |
return results
|
| 21 |
except Exception as e:
|
| 22 |
return f"Error running search: {str(e)}"
|
|
@@ -68,7 +69,6 @@ agent = CodeAgent(
|
|
| 68 |
prompt_templates=prompt_templates
|
| 69 |
)
|
| 70 |
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
print(search_web("iPhone"))
|
|
|
|
| 1 |
from smolagents import CodeAgent, HfApiModel,load_tool,tool
|
| 2 |
+
from ddgs import DDGS
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
|
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
with DDGS() as ddgs:
|
| 19 |
+
results = ddgs.text(query, max_results=5)
|
| 20 |
+
print(f"Results: {results}")
|
| 21 |
return results
|
| 22 |
except Exception as e:
|
| 23 |
return f"Error running search: {str(e)}"
|
|
|
|
| 69 |
prompt_templates=prompt_templates
|
| 70 |
)
|
| 71 |
|
| 72 |
+
print(search_web("iPhone"))
|
| 73 |
|
| 74 |
+
GradioUI(agent).launch()
|
|
|
|
|
|