Salman11223
commited on
Commit
•
c3c5aca
1
Parent(s):
55fc7f8
Update app.py
Browse files
app.py
CHANGED
@@ -6,18 +6,40 @@ def app(video_link):
|
|
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 |
-
|
15 |
|
16 |
interface = gr.Interface(
|
17 |
fn=app,
|
18 |
-
inputs=gr.Textbox(label="Enter YouTube link"),
|
19 |
-
outputs=[gr.Video(label
|
20 |
-
|
21 |
)
|
22 |
|
23 |
-
interface.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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), None # Return a tuple with video and placeholder for button
|
10 |
except Exception as e:
|
11 |
print(f"An error occurred: {str(e)}")
|
12 |
+
return None, None
|
|
|
|
|
13 |
|
14 |
interface = gr.Interface(
|
15 |
fn=app,
|
16 |
+
inputs=gr.Textbox(label="Enter YouTube link", placeholder="Paste YouTube video URL here"),
|
17 |
+
outputs=[gr.Video(label="Downloaded Video"), gr.Button("Download Video")],
|
|
|
18 |
)
|
19 |
|
20 |
+
interface.launch(debug=True)
|
21 |
+
|
22 |
+
|
23 |
+
# from youtube_video import download_youtube_video
|
24 |
+
# import gradio as gr
|
25 |
+
|
26 |
+
# def app(video_link):
|
27 |
+
# try:
|
28 |
+
# print(f"Received video link: {video_link}")
|
29 |
+
# video_path = download_youtube_video(video_link)
|
30 |
+
# print(f"Downloaded video path: {video_path}")
|
31 |
+
# return gr.Video(video_path)
|
32 |
+
# except Exception as e:
|
33 |
+
# print(f"An error occurred: {str(e)}")
|
34 |
+
# return None
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
# interface = gr.Interface(
|
39 |
+
# fn=app,
|
40 |
+
# inputs=gr.Textbox(label="Enter YouTube link"),
|
41 |
+
# outputs=[gr.Video(label = "video_path"), gr.Button("Download Video")],
|
42 |
+
|
43 |
+
# )
|
44 |
+
|
45 |
+
# interface.launch(debug=True)
|