SheilaDesanze's picture
Create app.py
0a92340 verified
raw
history blame
1.01 kB
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()