Salman11223 commited on
Commit
cbce115
1 Parent(s): 91d54bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -30
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
- except Exception as e:
19
- return f"An error occurred: {e}"
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
- # Deploy the Gradio interface with the Hugging Face app
26
- interface = gr.Interface(
27
- fn=huggingface_app,
28
- inputs=gr.Textbox(label="Enter YouTube link"),
29
- outputs=gr.Video(label="Your result"),
30
- live=True # Set live to True for continuous updates
31
- )
32
 
33
- # Launch the interface
 
 
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)