Salman11223 commited on
Commit
91d54bf
1 Parent(s): 34229e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -1,6 +1,23 @@
 
 
1
  from youtube_video import download_youtube_video
2
  import gradio as gr
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  def huggingface_app(video_link):
5
  # You can use the video link to download the video and return the path
6
  return download_and_return(video_link)
 
1
+ import os
2
+ import requests
3
  from youtube_video import download_youtube_video
4
  import gradio as gr
5
 
6
+ def download_and_return(video_link):
7
+ try:
8
+ print(f"Received video link: {video_link}")
9
+
10
+ video_path = download_youtube_video(video_link)
11
+
12
+ if video_path:
13
+ print(f"Downloaded video path: {video_path}")
14
+ return gr.Video(video_path)
15
+ else:
16
+ return "Error downloading video. Please check the YouTube link."
17
+
18
+ except Exception as e:
19
+ return f"An error occurred: {e}"
20
+
21
  def huggingface_app(video_link):
22
  # You can use the video link to download the video and return the path
23
  return download_and_return(video_link)