Salman11223
commited on
Commit
•
549d8a7
1
Parent(s):
5ea5a9d
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from youtube_video import download_youtube_video
|
2 |
import gradio as gr
|
3 |
|
4 |
video_link = None
|
@@ -8,10 +7,7 @@ def app(video_link):
|
|
8 |
video_link = video_link
|
9 |
try:
|
10 |
print(f"Received video link: {video_link}")
|
11 |
-
|
12 |
-
video_path = video_path
|
13 |
-
print(f"Downloaded video path: {video_path}")
|
14 |
-
return gr.Video(video_path)
|
15 |
except Exception as e:
|
16 |
print(f"An error occurred: {str(e)}")
|
17 |
return None
|
@@ -21,9 +17,49 @@ def app(video_link):
|
|
21 |
interface = gr.Interface(
|
22 |
fn=app,
|
23 |
inputs=gr.Textbox(label="Enter YouTube link"),
|
24 |
-
outputs=gr.Video(video_path)
|
25 |
|
26 |
# outputs=gr.Video(label="Your result")
|
27 |
)
|
28 |
|
29 |
-
interface.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
video_link = None
|
|
|
7 |
video_link = video_link
|
8 |
try:
|
9 |
print(f"Received video link: {video_link}")
|
10 |
+
|
|
|
|
|
|
|
11 |
except Exception as e:
|
12 |
print(f"An error occurred: {str(e)}")
|
13 |
return None
|
|
|
17 |
interface = gr.Interface(
|
18 |
fn=app,
|
19 |
inputs=gr.Textbox(label="Enter YouTube link"),
|
20 |
+
outputs=[gr.Video(video_path), gr.Button("Download Video")]
|
21 |
|
22 |
# outputs=gr.Video(label="Your result")
|
23 |
)
|
24 |
|
25 |
+
interface.launch(debug=True)
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
# from youtube_video import download_youtube_video
|
38 |
+
# import gradio as gr
|
39 |
+
|
40 |
+
# video_link = None
|
41 |
+
# video_path = None
|
42 |
+
|
43 |
+
# def app(video_link):
|
44 |
+
# video_link = video_link
|
45 |
+
# try:
|
46 |
+
# print(f"Received video link: {video_link}")
|
47 |
+
# video_path = download_youtube_video(video_link)
|
48 |
+
# video_path = video_path
|
49 |
+
# print(f"Downloaded video path: {video_path}")
|
50 |
+
# return gr.Video(video_path)
|
51 |
+
# except Exception as e:
|
52 |
+
# print(f"An error occurred: {str(e)}")
|
53 |
+
# return None
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
# interface = gr.Interface(
|
58 |
+
# fn=app,
|
59 |
+
# inputs=gr.Textbox(label="Enter YouTube link"),
|
60 |
+
# outputs=[gr.Video(video_path), gr.Button("Download Video")]
|
61 |
+
|
62 |
+
# # outputs=gr.Video(label="Your result")
|
63 |
+
# )
|
64 |
+
|
65 |
+
# interface.launch(debug=True)
|