Update app.py
Browse files
app.py
CHANGED
|
@@ -81,22 +81,6 @@ def search_google_images(query, num_images=1):
|
|
| 81 |
"key": api_key
|
| 82 |
}
|
| 83 |
).json()
|
| 84 |
-
else:
|
| 85 |
-
with requests_proxy.ProxyManager(proxies) as proxy_manager:
|
| 86 |
-
result = proxy_manager.get(
|
| 87 |
-
f"https://www.googleapis.com/customsearch/v1",
|
| 88 |
-
params={
|
| 89 |
-
"q": query,
|
| 90 |
-
"cx": cse_id,
|
| 91 |
-
"searchType": "image",
|
| 92 |
-
"num": num_images * 3,
|
| 93 |
-
"safe": 'off',
|
| 94 |
-
"imgSize": 'HUGE',
|
| 95 |
-
"imgType": 'photo',
|
| 96 |
-
"rights": 'cc_publicdomain|cc_attribute|cc_sharealike',
|
| 97 |
-
"key": api_key
|
| 98 |
-
}
|
| 99 |
-
).json()
|
| 100 |
|
| 101 |
if 'items' in result:
|
| 102 |
image_urls = []
|
|
@@ -119,7 +103,6 @@ def search_google_images(query, num_images=1):
|
|
| 119 |
print(f"Error general en la búsqueda de imágenes: {str(e)}")
|
| 120 |
return []
|
| 121 |
|
| 122 |
-
|
| 123 |
def process_image(image):
|
| 124 |
try:
|
| 125 |
width, height = image.size
|
|
|
|
| 81 |
"key": api_key
|
| 82 |
}
|
| 83 |
).json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
if 'items' in result:
|
| 86 |
image_urls = []
|
|
|
|
| 103 |
print(f"Error general en la búsqueda de imágenes: {str(e)}")
|
| 104 |
return []
|
| 105 |
|
|
|
|
| 106 |
def process_image(image):
|
| 107 |
try:
|
| 108 |
width, height = image.size
|