|
import gradio as gr |
|
from youtube_extractor import YouTubeExtractor |
|
|
|
extractor = YouTubeExtractor() |
|
|
|
def process_youtube_url(youtube_url): |
|
metadata, best_video_only, best_audio_only, best_combined = extractor.extract_info(youtube_url) |
|
return extractor.format_output(metadata, best_video_only, best_audio_only, best_combined) |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("## YouTube ๋ฉํ๋ฐ์ดํฐ ๋ฐ ๋ค์ด๋ก๋ ๋งํฌ ์ถ์ถ๊ธฐ") |
|
gr.Markdown("์ฃผ์: ์ด ๋๊ตฌ๋ฅผ ์ฌ์ฉํ์ฌ ์ ์๊ถ์ด ์๋ ์ฝํ
์ธ ๋ฅผ ๋ฌด๋จ์ผ๋ก ๋ค์ด๋ก๋ํ๋ ๊ฒ์ ๋ถ๋ฒ์
๋๋ค.") |
|
|
|
youtube_url_input = gr.Textbox(label="YouTube URL ์
๋ ฅ") |
|
extract_button = gr.Button("์ ๋ณด ์ถ์ถ") |
|
output = gr.Textbox(label="์ถ์ถ๋ ์ ๋ณด", lines=10) |
|
download_links = gr.HTML(label="๋ค์ด๋ก๋ ๋งํฌ") |
|
|
|
extract_button.click( |
|
fn=process_youtube_url, |
|
inputs=youtube_url_input, |
|
outputs=[output, download_links] |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |