File size: 728 Bytes
6ea0d31
cbce115
3c2cc03
5ea5a9d
 
 
cbce115
5ea5a9d
767950e
 
59b0b42
 
 
 
767950e
 
 
 
92fca80
da4fff6
767950e
 
 
549d8a7
92fca80
 
767950e
34229e7
6ea0d31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from youtube_video import download_youtube_video
import gradio as gr

video_link = None
video_path = None

def app(video_link):
    video_link = video_link
    try:
        print(f"Received video link: {video_link}")
        video_path = download_youtube_video(video_link)
        video_path = video_path
        print(f"Downloaded video path: {video_path}")
        return gr.Video(video_path)
    except Exception as e:
        print(f"An error occurred: {str(e)}")
        return None

        

interface = gr.Interface(
    fn=app,
    inputs=gr.Textbox(label="Enter YouTube link"),
    outputs=[gr.Video(video_path), gr.Button("Download Video")]

    # outputs=gr.Video(label="Your result")
)

interface.launch(debug=True)