Spaces:
Running
Running
arxivgpt kim
commited on
Commit
โข
a8d74c6
1
Parent(s):
a51cbe1
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import requests
|
|
3 |
|
4 |
def search_pexels_images(query):
|
5 |
API_KEY = '5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62' # Pexels API ํค๋ฅผ ์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์.
|
6 |
-
|
|
|
7 |
|
8 |
headers = {
|
9 |
"Authorization": API_KEY
|
@@ -13,7 +14,6 @@ def search_pexels_images(query):
|
|
13 |
|
14 |
images_urls = [photo['src']['medium'] for photo in data['photos']]
|
15 |
return images_urls
|
16 |
-
|
17 |
|
18 |
def show_search_results(query):
|
19 |
images_urls = search_pexels_images(query)
|
@@ -31,4 +31,5 @@ with gr.Blocks() as app:
|
|
31 |
inputs=search_query,
|
32 |
outputs=images_output
|
33 |
)
|
|
|
34 |
app.launch(debug=True)
|
|
|
3 |
|
4 |
def search_pexels_images(query):
|
5 |
API_KEY = '5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62' # Pexels API ํค๋ฅผ ์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์.
|
6 |
+
# ํ ํ์ด์ง๋น ๊ฒ์ ๊ฒฐ๊ณผ ์๋ฅผ 10๊ฐ๋ก ์ค์
|
7 |
+
url = f"https://api.pexels.com/v1/search?query={query}&per_page=80"
|
8 |
|
9 |
headers = {
|
10 |
"Authorization": API_KEY
|
|
|
14 |
|
15 |
images_urls = [photo['src']['medium'] for photo in data['photos']]
|
16 |
return images_urls
|
|
|
17 |
|
18 |
def show_search_results(query):
|
19 |
images_urls = search_pexels_images(query)
|
|
|
31 |
inputs=search_query,
|
32 |
outputs=images_output
|
33 |
)
|
34 |
+
|
35 |
app.launch(debug=True)
|