Spaces:
Running
Running
Update function signature
Browse files- helpers/image_search.py +6 -2
helpers/image_search.py
CHANGED
@@ -4,7 +4,7 @@ Search photos using Pexels API.
|
|
4 |
import os
|
5 |
import random
|
6 |
from io import BytesIO
|
7 |
-
from typing import Union, Tuple,
|
8 |
from urllib.parse import urlparse, parse_qs
|
9 |
|
10 |
import requests
|
@@ -14,7 +14,11 @@ REQUEST_TIMEOUT = 12
|
|
14 |
MAX_PHOTOS = 2
|
15 |
|
16 |
|
17 |
-
def search_pexels(
|
|
|
|
|
|
|
|
|
18 |
"""
|
19 |
Searches for images on Pexels using the provided query.
|
20 |
|
|
|
4 |
import os
|
5 |
import random
|
6 |
from io import BytesIO
|
7 |
+
from typing import Union, Tuple, Literal
|
8 |
from urllib.parse import urlparse, parse_qs
|
9 |
|
10 |
import requests
|
|
|
14 |
MAX_PHOTOS = 2
|
15 |
|
16 |
|
17 |
+
def search_pexels(
|
18 |
+
query: str,
|
19 |
+
size: Literal['small', 'medium', 'large'] = 'medium',
|
20 |
+
per_page: int = MAX_PHOTOS
|
21 |
+
) -> dict:
|
22 |
"""
|
23 |
Searches for images on Pexels using the provided query.
|
24 |
|