Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -180,7 +180,28 @@ class WebNavigator(BasicAgent):
|
|
180 |
"message": str(e)
|
181 |
})
|
182 |
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
186 |
"""
|
|
|
180 |
"message": str(e)
|
181 |
})
|
182 |
|
183 |
+
|
184 |
+
# After all your class definitions...
|
185 |
+
|
186 |
+
if __name__ == "__main__":
|
187 |
+
import json
|
188 |
+
from datetime import datetime
|
189 |
+
import requests
|
190 |
+
from bs4 import BeautifulSoup
|
191 |
+
|
192 |
+
# Initialize the navigator
|
193 |
+
navigator = WebNavigator()
|
194 |
+
|
195 |
+
# Example 1: Perform a search
|
196 |
+
search_results = navigator("Python web scraping")
|
197 |
+
print("\nSearch results:")
|
198 |
+
print(search_results[:500] + "...") # Print first 500 chars
|
199 |
+
|
200 |
+
# Example 2: Visit a URL directly
|
201 |
+
url_result = navigator("https://example.com")
|
202 |
+
print("\nURL visit results:")
|
203 |
+
print(url_result)
|
204 |
+
|
205 |
|
206 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
207 |
"""
|