File size: 819 Bytes
8626295 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from youtubesearchpython import VideosSearch
import gradio as gr
def search_youtube_videos(keyword, limit=5):
videos_search = VideosSearch(keyword, limit=limit)
results = videos_search.result()
video_urls = [video['link'] for video in results['result']]
return video_urls
def gradio_interface(keyword):
video_urls = search_youtube_videos(keyword, limit=5)
return "\n".join(video_urls)
interface = gr.Interface(
fn=gradio_interface,
inputs=gr.Textbox(label="κ²μ ν€μλλ₯Ό μ
λ ₯νμΈμ"),
outputs=gr.Textbox(label="κ²μλ μ νλΈ λμμ URL"),
title="μ νλΈ κ²μ λμ°λ―Έ",
description="ν€μλλ₯Ό μ
λ ₯νλ©΄ μ νλΈμμ ν΄λΉ ν€μλλ‘ κ²μν ν λμμ URLμ 보μ¬μ€λλ€."
)
if __name__ == "__main__":
interface.launch() |