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