|
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): |
|
|
|
return download_and_return(video_link) |
|
|
|
|
|
interface = gr.Interface( |
|
fn=huggingface_app, |
|
inputs=gr.Textbox(label="Enter YouTube link"), |
|
outputs=gr.Video(label="Your result"), |
|
live=True |
|
) |
|
|
|
|
|
interface.launch(debug = True) |