Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -22,13 +22,16 @@ def search_pexels_videos(query):
|
|
22 |
videos_urls = []
|
23 |
return videos_urls
|
24 |
|
25 |
-
|
|
|
26 |
def show_video_search_results(query):
|
27 |
videos_info = search_pexels_videos(query)
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
|
33 |
|
34 |
# Pexels μ΄λ―Έμ§ κ²μ ν¨μ
|
@@ -209,12 +212,12 @@ with gr.Blocks() as app:
|
|
209 |
gr.Markdown("### FREE Video Search")
|
210 |
video_search_query = gr.Textbox(label="λΉλμ€ κ²μ")
|
211 |
video_search_btn = gr.Button("κ²μ")
|
212 |
-
|
|
|
213 |
video_search_btn.click(
|
214 |
fn=show_video_search_results,
|
215 |
inputs=video_search_query,
|
216 |
outputs=videos_output
|
217 |
)
|
218 |
|
219 |
-
|
220 |
app.launch(debug=True)
|
|
|
22 |
videos_urls = []
|
23 |
return videos_urls
|
24 |
|
25 |
+
|
26 |
+
# Pexels λμμ κ²μ κ²°κ³Όλ₯Ό HTML λ§ν¬λ‘ νμνλ ν¨μ
|
27 |
def show_video_search_results(query):
|
28 |
videos_info = search_pexels_videos(query)
|
29 |
+
# HTML λ§ν¬ μμ±
|
30 |
+
videos_html = [
|
31 |
+
f"<div style='margin: 10px;'><a href='{video['url']}' target='_blank' style='text-decoration: none;'><img src='{video['image']}' alt='Video thumbnail' style='width: 100%;'><p>View Video</p></a></div>"
|
32 |
+
for video in videos_info
|
33 |
+
]
|
34 |
+
return "".join(videos_html)
|
35 |
|
36 |
|
37 |
# Pexels μ΄λ―Έμ§ κ²μ ν¨μ
|
|
|
212 |
gr.Markdown("### FREE Video Search")
|
213 |
video_search_query = gr.Textbox(label="λΉλμ€ κ²μ")
|
214 |
video_search_btn = gr.Button("κ²μ")
|
215 |
+
# HTML μ»΄ν¬λνΈλ‘ λΉλμ€ κ²μ κ²°κ³Ό νμ
|
216 |
+
videos_output = gr.HTML(label="κ²μ κ²°κ³Ό λμμ")
|
217 |
video_search_btn.click(
|
218 |
fn=show_video_search_results,
|
219 |
inputs=video_search_query,
|
220 |
outputs=videos_output
|
221 |
)
|
222 |
|
|
|
223 |
app.launch(debug=True)
|