arxivgpt kim commited on
Commit
a8d74c6
โ€ข
1 Parent(s): a51cbe1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,7 +3,8 @@ import requests
3
 
4
  def search_pexels_images(query):
5
  API_KEY = '5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62' # Pexels API ํ‚ค๋ฅผ ์—ฌ๊ธฐ์— ์ž…๋ ฅํ•˜์„ธ์š”.
6
- url = f"https://api.pexels.com/v1/search?query={query}&per_page=5" # ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ 5๊ฐœ๋งŒ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
 
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)