Spaces:
Build error
Build error
Update tools/web_search_tools.py
Browse files
tools/web_search_tools.py
CHANGED
|
@@ -3,9 +3,6 @@ from bs4 import BeautifulSoup
|
|
| 3 |
import json
|
| 4 |
import os
|
| 5 |
|
| 6 |
-
import requests
|
| 7 |
-
from bs4 import BeautifulSoup
|
| 8 |
-
|
| 9 |
class WebSearchTools:
|
| 10 |
|
| 11 |
@staticmethod
|
|
@@ -40,11 +37,10 @@ class WebSearchTools:
|
|
| 40 |
return text
|
| 41 |
|
| 42 |
# Example usage
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
return results
|
| 48 |
|
| 49 |
|
| 50 |
|
|
|
|
| 3 |
import json
|
| 4 |
import os
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
class WebSearchTools:
|
| 7 |
|
| 8 |
@staticmethod
|
|
|
|
| 37 |
return text
|
| 38 |
|
| 39 |
# Example usage
|
| 40 |
+
if __name__ == "__main__":
|
| 41 |
+
image_urls = WebSearchTools.search_images("random forest")
|
| 42 |
+
for idx, img_url in enumerate(image_urls):
|
| 43 |
+
WebSearchTools.download_image(img_url, f'image_{idx}.png')
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
|