Spaces:
Running
Running
Update imgsearch.py
Browse files- imgsearch.py +1 -1
imgsearch.py
CHANGED
@@ -5,7 +5,7 @@ from env import GOOGLE_API_KEY, CX
|
|
5 |
def search_img(term, orientation="landscape"):
|
6 |
_t = f"{orientation} image of {term}"
|
7 |
_ret = requests.get(
|
8 |
-
url=f"https://www.googleapis.com/customsearch/v1?key={
|
9 |
)
|
10 |
try:
|
11 |
return choice(_ret.json()['items'][:10])['link']
|
|
|
5 |
def search_img(term, orientation="landscape"):
|
6 |
_t = f"{orientation} image of {term}"
|
7 |
_ret = requests.get(
|
8 |
+
url=f"https://www.googleapis.com/customsearch/v1?key={IMSEARCH_API_KEY}&cx={CX}&q={_t}&searchType=image&fields=items(link)"
|
9 |
)
|
10 |
try:
|
11 |
return choice(_ret.json()['items'][:10])['link']
|