File size: 1,015 Bytes
91d54bf
 
802939d
cfdee17
36ecbae
91d54bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34229e7
 
 
3c2cc03
34229e7
 
 
 
 
 
 
 
 
509aa7d
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
import os
import requests
from youtube_video import download_youtube_video
import gradio as gr

def download_and_return(video_link):
    try:
        print(f"Received video link: {video_link}")
        
        video_path = download_youtube_video(video_link)
        
        if video_path:
            print(f"Downloaded video path: {video_path}")
            return gr.Video(video_path)
        else:
            return "Error downloading video. Please check the YouTube link."

    except Exception as e:
        return f"An error occurred: {e}"

def huggingface_app(video_link):
    # You can use the video link to download the video and return the path
    return download_and_return(video_link)

# Deploy the Gradio interface with the Hugging Face app
interface = gr.Interface(
    fn=huggingface_app,
    inputs=gr.Textbox(label="Enter YouTube link"),
    outputs=gr.Video(label="Your result"),
    live=True  # Set live to True for continuous updates
)

# Launch the interface
interface.launch(debug = True)