Salman11223 commited on
Commit
767950e
1 Parent(s): 4f1def8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -1,16 +1,20 @@
1
-
2
  from youtube_video import download_youtube_video
3
  import gradio as gr
4
 
5
  def app(video_link):
6
- print(f"Received video link: {video_link}")
7
-
8
- video_path = download_youtube_video(video_link)
9
- print(f"Downloaded video path: {video_path}")
10
-
11
- return gr.Video(video_path)
 
 
 
 
 
 
 
 
12
 
13
- interface = gr.Interface(fn=app,
14
- inputs=gr.Textbox(label="Enter YouTube link"),
15
- outputs=gr.Video(label="Your result"))
16
- interface.launch(debug = True)
 
 
1
  from youtube_video import download_youtube_video
2
  import gradio as gr
3
 
4
  def app(video_link):
5
+ try:
6
+ print(f"Received video link: {video_link}")
7
+ video_path = download_youtube_video(video_link)
8
+ print(f"Downloaded video path: {video_path}")
9
+ return gr.Video(video_path)
10
+ except Exception as e:
11
+ print(f"An error occurred: {str(e)}")
12
+ return None
13
+
14
+ interface = gr.Interface(
15
+ fn=app,
16
+ inputs=gr.Textbox(label="Enter YouTube link"),
17
+ outputs=gr.Video(label="Your result")
18
+ )
19
 
20
+ interface.launch(debug=True)