File size: 1,286 Bytes
cbce115
3c2cc03
5ea5a9d
 
 
cbce115
5ea5a9d
767950e
 
549d8a7
767950e
 
 
 
92fca80
da4fff6
767950e
 
 
549d8a7
92fca80
 
767950e
34229e7
549d8a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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}")

    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)











# 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)