Xhaheen commited on
Commit
9eab490
·
verified ·
1 Parent(s): 4f67e8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -14
app.py CHANGED
@@ -2,20 +2,33 @@ import gradio as gr
2
  from pytube import YouTube
3
 
4
  def download_video(url):
5
- try:
6
- yt = YouTube(url)
7
- highest_res_stream = yt.streams.get_highest_resolution()
8
- video_path = highest_res_stream.download()
9
- return video_path
10
- except Exception as e:
11
- return f"Error: {e}"
12
 
13
- iface = gr.Interface(
14
- fn=download_video,
15
- inputs=gr.Textbox(label="YouTube Video URL"),
16
- outputs=gr.Video(label="Downloaded Video"),
17
- title="YouTube Video Downloader",
18
- description="Enter the URL of a YouTube video to download it.",
19
  )
20
 
21
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from pytube import YouTube
3
 
4
  def download_video(url):
5
+ try:
6
+ yt = YouTube(url)
7
+ highest_res_stream = yt.streams.get_highest_resolution()
8
+ video_path = highest_res_stream.download()
9
+ return video_path
10
+ except Exception as e:
11
+ return f"Error: {e}"
12
 
13
+ # Creating a pink theme
14
+ pink_theme = gr.themes.Default(
15
+ primary_hue="pink",
16
+ secondary_hue="rose",
 
 
17
  )
18
 
19
+ with gr.Blocks(theme=pink_theme) as interface:
20
+ gr.Markdown(
21
+ """
22
+ Downloads: YouTube Video Downloader 💖
23
+
24
+ This app lets you download YouTube videos in the highest available resolution.
25
+ Just paste the video URL and click "Download"!
26
+ """
27
+ )
28
+ with gr.Row():
29
+ url_textbox = gr.Textbox(label="Paste the YouTube Video URL Here")
30
+ download_button = gr.Button("Download 📥")
31
+ video_output = gr.Video(label="Downloaded Video 📺")
32
+ download_button.click(download_video, inputs=url_textbox, outputs=video_output)
33
+
34
+ interface.launch()