seawolf2357 commited on
Commit
49ea093
β€’
1 Parent(s): ef26ce8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,7 +1,8 @@
 
1
  from googleapiclient.discovery import build
2
  import gradio as gr
3
 
4
- # API 킀와 검색 엔진 ID μ„€μ • (λ³΄μ•ˆμ„ μœ„ν•΄ μ‹€μ œ ν‚€λŠ” 여기에 직접 ν¬ν•¨μ‹œν‚€μ§€ μ•ŠμŒ)
5
  API_KEY = 'AIzaSyDUz3wkGal0ewRtPlzeMit88bV4hS4ZIVY'
6
  CSE_ID = '56b34994f47704ddd'
7
 
@@ -16,7 +17,11 @@ def multi_search(query):
16
  video_search_result = youtube.search().list(q=query, part='snippet', type='video', maxResults=5).execute()
17
  video_results = [f"https://www.youtube.com/watch?v={item['id']['videoId']}" for item in video_search_result.get('items', [])]
18
 
19
- return web_results, video_results
 
 
 
 
20
 
21
  iface = gr.Interface(
22
  fn=multi_search,
 
1
+
2
  from googleapiclient.discovery import build
3
  import gradio as gr
4
 
5
+ # API 킀와 검색 엔진 ID μ„€μ •
6
  API_KEY = 'AIzaSyDUz3wkGal0ewRtPlzeMit88bV4hS4ZIVY'
7
  CSE_ID = '56b34994f47704ddd'
8
 
 
17
  video_search_result = youtube.search().list(q=query, part='snippet', type='video', maxResults=5).execute()
18
  video_results = [f"https://www.youtube.com/watch?v={item['id']['videoId']}" for item in video_search_result.get('items', [])]
19
 
20
+ # 검색 κ²°κ³Όλ₯Ό νŠœν”Œμ˜ 리슀트둜 λ³€ν™˜
21
+ web_results_tuples = [(url,) for url in web_results]
22
+ video_results_tuples = [(url,) for url in video_results]
23
+
24
+ return web_results_tuples, video_results_tuples
25
 
26
  iface = gr.Interface(
27
  fn=multi_search,