Salman11223
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,16 @@
|
|
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 |
-
|
19 |
-
|
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)
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
)
|
32 |
|
33 |
-
|
|
|
|
|
34 |
interface.launch(debug = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|